chore: import upstream snapshot with attribution
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:30:11 +08:00
commit 70bf21e064
5213 changed files with 731895 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import { AsyncLocalStorage } from "node:async_hooks";
const asyncLocalStorage = new AsyncLocalStorage<number>();
export default {
async fetch(req: Request, env: unknown, ctx: ExecutionContext) {
if (new URL(req.url).pathname !== "/") {
return new Response("No Found", { status: 404 });
}
const results = await Promise.all([
asyncLocalStorage.run(1, async () => getValue()),
asyncLocalStorage.run(2, async () => getValue()),
asyncLocalStorage.run(3, async () => getValue()),
]);
return new Response(`Working ${JSON.stringify(results)}`);
},
};
async function getValue() {
await new Promise((resolve) => setTimeout(resolve, 1000));
return asyncLocalStorage.getStore();
}