-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix: OPTIC-1420: Inner IDs are duplicated and counted wrong #6785
Conversation
✅ Deploy Preview for label-studio-docs-new-theme ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for heartex-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #6785 +/- ##
========================================
Coverage 76.77% 76.78%
========================================
Files 171 171
Lines 14021 14023 +2
========================================
+ Hits 10765 10767 +2
Misses 3256 3256
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
/git merge develop
|
/git merge develop
|
PR fulfills these requirements
[fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made
ex.fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
Change has impacts in these area(s)
(check all that apply)
Describe the reason for change
There was an issue where the inner_id was duplicated when importing from the API. We identified the problem because a client was importing with two requests almost at the same time, causing a race condition when calculating the inner_id.
What does this fix?
Potential duplicate inner ids due to a race condition when importing from the API.
What is the new behavior?
Acquire lock on the project before calculating inner id. I tried to acquire the lock on the Tasks queryset, but when there weren't any tasks yet it wouldn't work, because it locks on the returned rows (empty the first time).
Does this change affect performance?
If there are multiple async imports for a same project at once like this case, they will eventually be committed sequentially. This is needed to ensure inner_id consistency.
Does this PR introduce a breaking change?
(check only one)
What level of testing was included in the change?
(check all that apply)
For testing I created a small script to replicate this behavior. Running two separate worker processes is also needed, so they can consume each import job concurrently.
Which logical domain(s) does this change affect?
Imports