Repository navigation
feat(scheduled-tasks): replay dedupe and coalescing for webhook deliveries #22234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+3,123
−326
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
df3d434
feat(scheduled-tasks): replay dedupe and coalescing for webhook deliv…
juliusmarminge d9cf621
test(server): include webhook dedupe in migration expectations
juliusmarminge 4367d23
fix(scheduled-tasks): bound dedupe writes and recover webhook dispatch
juliusmarminge b8c0d8e
fix(scheduled-tasks): bound webhook failures and preserve coalesced p…
juliusmarminge db9c400
Merge remote-tracking branch 'origin/main' into feat/webhook-dedupe
juliusmarminge 2f52fa6
fix(scheduled-tasks): refund only the matching webhook rate reservation
juliusmarminge 340e762
fix(scheduled-tasks): preserve dispatched webhook deliveries during r…
juliusmarminge c624525
fix(scheduled-tasks): retain acknowledged coalesced relay claims
juliusmarminge 94edd65
fix(scheduled-tasks): bound webhook windows and recover all delivery …
juliusmarminge 55e6d07
fix(scheduled-tasks): accept dedupe hits at full run budget
juliusmarminge 1e76337
fix(scheduled-tasks): preserve webhook delivery labels and payload de…
juliusmarminge 02e2174
fix(scheduled-tasks): recover render defects and count the active del…
juliusmarminge 90a67c1
fix(web): clarify pending webhook window details
juliusmarminge 1ba4a66
chore(scheduled-tasks): merge main webhook filters into dedupe
juliusmarminge e2a5194
fix(contracts): bound webhook dedupe template validation
juliusmarminge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
apps/server/src/persistence/Migrations/067_WebhookDedupe.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import * as Effect from "effect/Effect"; | ||
| import * as SqlClient from "effect/sql/SqlClient"; | ||
|
|
||
| export default Effect.gen(function* () { | ||
| const sql = yield* SqlClient.SqlClient; | ||
| yield* sql`CREATE TABLE scheduled_task_webhook_replay_keys ( | ||
| task_id TEXT NOT NULL REFERENCES scheduled_tasks(task_id) ON DELETE CASCADE, | ||
| replay_key TEXT NOT NULL, | ||
| delivery_id TEXT NOT NULL, | ||
| expires_at INTEGER NOT NULL, | ||
| PRIMARY KEY (task_id, replay_key) | ||
| )`; | ||
| yield* sql`CREATE INDEX idx_webhook_replay_expiry ON scheduled_task_webhook_replay_keys(expires_at)`; | ||
| yield* sql`CREATE INDEX idx_webhook_replay_delivery ON scheduled_task_webhook_replay_keys(delivery_id)`; | ||
| yield* sql`CREATE TABLE scheduled_task_webhook_runs ( | ||
| delivery_id TEXT PRIMARY KEY, | ||
| task_id TEXT NOT NULL REFERENCES scheduled_tasks(task_id) ON DELETE CASCADE | ||
| )`; | ||
| yield* sql`CREATE TABLE scheduled_task_webhook_pending ( | ||
| delivery_id TEXT PRIMARY KEY, | ||
| task_id TEXT NOT NULL REFERENCES scheduled_tasks(task_id) ON DELETE CASCADE, | ||
| coalesce_key TEXT NOT NULL, | ||
| due_at INTEGER NOT NULL, | ||
| state TEXT NOT NULL DEFAULT 'pending', | ||
| task_json TEXT NOT NULL, | ||
| request_json TEXT NOT NULL | ||
| )`; | ||
| yield* sql`CREATE INDEX idx_webhook_pending_due ON scheduled_task_webhook_pending(state, due_at)`; | ||
| yield* sql`CREATE UNIQUE INDEX idx_webhook_pending_key | ||
| ON scheduled_task_webhook_pending(task_id, coalesce_key) WHERE state = 'pending'`; | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.