Fix: Tag deletion timeout issue

- Change cache purging from synchronous to asynchronous
- Prevents "Delete Failed" false positives when Cloudflare API is slow
- Tags are now deleted immediately while cache purges in background
- Uses waitUntil() for non-blocking cache operations
This commit is contained in:
Se@n
2025-10-11 13:10:55 +08:00
parent a86e8b522d
commit c7c7b5054f

View File

@@ -168,9 +168,9 @@ async function handleUpdateTags(context, db, fileId, hostname) {
metadata: fileData.metadata
});
// Clear CDN cache
// Clear CDN cache asynchronously (don't wait for it to complete)
const cdnUrl = `https://${hostname}/file/${fileId}`;
await purgeCFCache(context.env, cdnUrl);
waitUntil(purgeCFCache(context.env, cdnUrl));
// Update file index asynchronously
waitUntil(addFileToIndex(context, fileId, fileData.metadata));