fix(webhook): dedup duplicate deliveries, cache HMAC key, pass ExecutionContext

Skip re-processing when the same X-GitHub-Delivery id is seen (KV, 300s TTL)
to stop double pushes when both an org and an App webhook target the worker.
Pass ExecutionContext through so dispatch runs via waitUntil instead of a
fire-and-forget that gets frozen. Cache the imported HMAC key per secret.
This commit is contained in:
RhenCloud 2026-08-02 06:51:20 +08:00
parent c75cc058fc
commit befed0267a
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
3 changed files with 37 additions and 13 deletions

View file

@ -9,8 +9,8 @@ export { DiscordGateway };
const app = createServer();
export default {
async fetch(request: Request, env: Env): Promise<Response> {
return app.fetch(request, env);
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
return app.fetch(request, env, ctx);
},
async scheduled(_event: ScheduledEvent, env: Env): Promise<void> {