Skip to content

Commit

Permalink
Fix locationHint not being passed when purging the cache (#2504)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse committed Sep 30, 2024
1 parent 4df235d commit a69ff27
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/cache-do/src/CacheObjectStub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ export class CacheObjectStub {
await Promise.all(
allLocations.map(async (locationId) => {
const groupId = getCacheObjectIdName(locationId, this.tag);
const cacheGroup = this.doNamespace.get(this.doNamespace.idFromName(groupId));
const cacheGroup = this.doNamespace.get(this.doNamespace.idFromName(groupId), {
// Initialize the object with a locaiton hint,
// as we might want to purge all locations before the object is created.
// https://developers.cloudflare.com/durable-objects/reference/data-location/
locationHint: doLocationHints[this.locationId],
});
const locationkeys = await cacheGroup.purge();
locationkeys.forEach((key) => keys.add(key));
}),
Expand Down

0 comments on commit a69ff27

Please sign in to comment.