-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(idempotency): add conflict target to atomicallyClaimDb query + remove redundant db namespace tracking #2950
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR simplifies the idempotency system by removing the Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant WebhookExecution as Webhook Execution
participant IdempotencyService
participant Database
Client->>WebhookExecution: Send webhook
WebhookExecution->>IdempotencyService: executeWithIdempotency(provider, id)
IdempotencyService->>IdempotencyService: normalizeKey (namespace:provider:id)
IdempotencyService->>IdempotencyService: atomicallyClaim()
IdempotencyService->>Database: INSERT with onConflictDoNothing(target: key)
alt First Request (claim succeeds)
Database-->>IdempotencyService: Insert successful
IdempotencyService->>WebhookExecution: claimed: true
WebhookExecution->>WebhookExecution: Execute operation
WebhookExecution->>IdempotencyService: storeResult()
IdempotencyService->>Database: INSERT/UPDATE with onConflictDoUpdate(target: key)
Database-->>IdempotencyService: Result stored
IdempotencyService-->>WebhookExecution: Success
WebhookExecution-->>Client: 200 OK
else Duplicate Request (conflict)
Database-->>IdempotencyService: Conflict on key
IdempotencyService->>Database: SELECT existing result
Database-->>IdempotencyService: Return cached result
IdempotencyService->>WebhookExecution: claimed: false, existingResult
WebhookExecution-->>Client: Return cached result
end
|
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Summary
Type of Change
Testing
Tested manually
Checklist