@cloudflare/workers-response-store 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/binding.js +13 -1
- package/package.json +1 -1
package/dist/binding.js
CHANGED
|
@@ -350,10 +350,15 @@ var ResponseStoreBinding = class extends WorkerEntrypoint {
|
|
|
350
350
|
return entry !== null;
|
|
351
351
|
}, () => true);
|
|
352
352
|
pendingR2Reads.set(readKey, pending);
|
|
353
|
+
let cleared;
|
|
354
|
+
this.ctx.waitUntil(new Promise((resolve) => {
|
|
355
|
+
cleared = resolve;
|
|
356
|
+
}));
|
|
353
357
|
try {
|
|
354
358
|
return await read;
|
|
355
359
|
} finally {
|
|
356
360
|
if (pendingR2Reads.get(readKey) === pending) pendingR2Reads.delete(readKey);
|
|
361
|
+
cleared();
|
|
357
362
|
}
|
|
358
363
|
}
|
|
359
364
|
async writeR2Revision(objectKey, revision, body, customMetadata, expectedEtag) {
|
|
@@ -707,7 +712,13 @@ var ResponseStoreBinding = class extends WorkerEntrypoint {
|
|
|
707
712
|
reservation ??= await this.reserveWrite(metadata, cacheKey, cacheTags);
|
|
708
713
|
return this.storeResponse(metadata, request, response, options.revalidator, options.expiryBehavior === "miss" ? "miss" : "regenerate", reservation, cacheTags);
|
|
709
714
|
})();
|
|
710
|
-
|
|
715
|
+
let cleared = () => {};
|
|
716
|
+
if (options.coalesce) {
|
|
717
|
+
pendingPuts.set(pendingPutKey, write);
|
|
718
|
+
this.ctx.waitUntil(new Promise((resolve) => {
|
|
719
|
+
cleared = resolve;
|
|
720
|
+
}));
|
|
721
|
+
}
|
|
711
722
|
try {
|
|
712
723
|
const result = await write;
|
|
713
724
|
if (!result.published || !result.entry) return {
|
|
@@ -720,6 +731,7 @@ var ResponseStoreBinding = class extends WorkerEntrypoint {
|
|
|
720
731
|
};
|
|
721
732
|
} finally {
|
|
722
733
|
if (options.coalesce && pendingPuts.get(pendingPutKey) === write) pendingPuts.delete(pendingPutKey);
|
|
734
|
+
cleared();
|
|
723
735
|
}
|
|
724
736
|
}
|
|
725
737
|
async refresh(options) {
|