-
Notifications
You must be signed in to change notification settings - Fork 1
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
Consumer API: Starting multiple sync runs in parallel leads to an internal server error #512
Conversation
@coderabbitai review |
Important Auto Review SkippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the WalkthroughThe modification in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- Modules/Synchronization/src/Synchronization.Application/SyncRuns/Commands/StartSyncRun/Handler.cs (1 hunks)
Additional comments: 1
Modules/Synchronization/src/Synchronization.Application/SyncRuns/Commands/StartSyncRun/Handler.cs (1)
- 136-136: The update to the catch block in the
CreateNewSyncRun
method to includeUniqueKeyViolation
alongsideDuplicateIndex
when handlingDbUpdateException
is a crucial improvement. This change ensures that exceptions caused by unique constraint violations, which indicate an attempt to start a new sync run when another is already in progress, are properly caught and handled. This adjustment aligns with the PR's objective to enhance the reliability and consistency of synchronization operations by preventing multiple concurrent sync runs through improved error detection and handling.
…hd/backbone into fix-multiple-sync-runs-error
Readiness checklist
Description
Due to the concurrency involved in the sync runs, the test results were not consistent between the runs. However, by setting the breakpoints at
Backbone.Modules.Synchronization.Application.SyncRuns.Commands.StartSyncRun.Handler
(lines 129 and 137) the relevant exception was caught and examined. Thecatch
block was previously implemented like so:The problem with the tests was that some of the
DbUpdateException
instances were not being caught by theif
check. Code examination ofDbUpdateException
yields the following condition:Examination of the exception caught previously revealed the following values:
In other words, no criteria defined for the
DuplicateIndex
variety of theDbUpdateExceptionReason
was met. On the other hand, the exception matched theUniqueKeyViolation
variety well:For that reason the check in the
catch
block was updated as follows:The tests now pass as expected.
Summary by CodeRabbit