fix: shard async track FIFO message groups - #2357
Merged
Merged
Conversation
Contributor
|
Capy auto-review is paused for this organization because the usage-cycle auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Shards async track FIFO message groups deterministically across eight lanes using the SQS deduplication ID. This applies only to the dedicated async track queue; the fail-open track queue keeps its existing customer/entity grouping.\n\nTests: server typecheck; 16 targeted async track, batch track, and queue track unit tests.
Summary by cubic
Shard async track SQS FIFO message groups into 8 deterministic lanes using the message deduplication ID to reduce head-of-line blocking and improve throughput. Applies only to the dedicated async track queue; the fail-open queue keeps its existing customer/entity grouping.
getAsyncTrackMessageGroupIdto hash the dedupe ID into 8 shards; group ID format:org:env:customer:entity:shard-[0-7].runAsyncTrackandrunBatchTrackto set the newmessageGroupId;queueTracknow accepts an optionalmessageGroupId.Written for commit 29d6160. Summary will update on new commits.
Greptile Summary
This PR shards messages on the dedicated async track FIFO queue across eight lanes. The main changes are:
Confidence Score: 4/5
The async grouping path can reorder balance-affecting events for the same customer and entity.
server/src/internal/balances/track/utils/getAsyncTrackMessageGroupId.ts
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client participant API participant A as FIFO shard A participant B as FIFO shard B participant Worker Client->>API: Event 1 for customer/entity API->>A: Group from request ID 1 Client->>API: Event 2 for same customer/entity API->>B: Group from request ID 2 B->>Worker: Event 2 may run first A->>Worker: Event 1 may run later Note over Worker: Balance operations observe reversed orderPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "🐛 fix(track): shard async FIFO message ..." | Re-trigger Greptile
Context used: