Skip to content

Commit a2eb7dc

Browse files
committed
Add logging
1 parent 94ec222 commit a2eb7dc

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

workers/handler/src/index.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,18 @@ async function cachePurgeTag(batch: MessageBatch, env: Env) {
107107
// sendBatch only allows for a maximum of 100 messages.
108108
const promises: ReturnType<typeof env.DB.batch>[] = [];
109109
for (const urlChunk of chunks(results, 100)) {
110+
const batch = urlChunk.map<
111+
MessageSendRequest<z.infer<typeof PurgeUrlSchema>>
112+
>((data) => ({
113+
body: {
114+
url: data.value,
115+
zone: data.zone,
116+
},
117+
contentType: "json",
118+
}));
119+
console.debug("[Cache Purge Tag] Send Batch", batch);
110120
promises.push(
111-
env.CACHE_PURGE_URL.sendBatch(
112-
urlChunk.map<MessageSendRequest<z.infer<typeof PurgeUrlSchema>>>(
113-
(data) => ({
114-
body: {
115-
url: data.value,
116-
zone: data.zone,
117-
},
118-
contentType: "json",
119-
}),
120-
),
121-
).then(() => {
121+
env.CACHE_PURGE_URL.sendBatch(batch).then(() => {
122122
const ids = urlChunk.map<string>(({ id }) => id);
123123
return env.DB.batch([
124124
env.DB.prepare(

0 commit comments

Comments
 (0)