Skip to content

Commit a69ff27

Browse files
authored
Fix locationHint not being passed when purging the cache (#2504)
1 parent 4df235d commit a69ff27

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/cache-do/src/CacheObjectStub.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ export class CacheObjectStub {
7777
await Promise.all(
7878
allLocations.map(async (locationId) => {
7979
const groupId = getCacheObjectIdName(locationId, this.tag);
80-
const cacheGroup = this.doNamespace.get(this.doNamespace.idFromName(groupId));
80+
const cacheGroup = this.doNamespace.get(this.doNamespace.idFromName(groupId), {
81+
// Initialize the object with a locaiton hint,
82+
// as we might want to purge all locations before the object is created.
83+
// https://developers.cloudflare.com/durable-objects/reference/data-location/
84+
locationHint: doLocationHints[this.locationId],
85+
});
8186
const locationkeys = await cacheGroup.purge();
8287
locationkeys.forEach((key) => keys.add(key));
8388
}),

0 commit comments

Comments
 (0)