-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(backend): prevent duplicate ingestion of events
- add postgres migration to add `status` column in `event_reqs` table - prevent duplicate ingestion of events by keeping track of a `status` column in `event_reqs` table - send `retry-after` response header if another identical request is being processed - rollback gracefully to cleanup event requests in `pending` state if request fails at any point - use defer to end all otel spans in ingestion fixes #1277 Signed-off-by: detj <[email protected]>
- Loading branch information
Showing
2 changed files
with
168 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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 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,12 @@ | ||
-- migrate:up | ||
alter table if exists event_reqs | ||
add status int default 0; | ||
|
||
comment on column event_reqs.status is 'status of event request: 0 is pending, 1 is done'; | ||
|
||
update event_reqs set status = 1; | ||
|
||
-- migrate:down | ||
alter table if exists event_reqs | ||
drop if exists status; | ||
|