Skip to content
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 race condition with async API operations #1380

Merged
merged 1 commit into from
Oct 22, 2024
Merged

Conversation

neolynx
Copy link
Member

@neolynx neolynx commented Oct 22, 2024

Fixes #1376

Description of the Change

  • fix race condition with rasync background operations
  • Do all relevant database reading inside maybeRunTaskInBackground.
  • Notably, LoadComplete will load the reflist of a repo. if this is done outside of a background operation, the data might be outdated when the background tasks runs.

Do all relevant database reading/modifying inside `maybeRunTaskInBackground`.

Notably, `LoadComplete` will load the reflist of a repo. if this is done outside of a background operation,
the data might be outdated when the background tasks runs.
@neolynx neolynx requested a review from a team October 22, 2024 13:15
@neolynx neolynx self-assigned this Oct 22, 2024
@neolynx neolynx added the needs review Ready for review & merge label Oct 22, 2024
@neolynx neolynx changed the title fix race condition with repo add files Fix race condition with async API operations Oct 22, 2024
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 47.05882% with 45 lines in your changes missing coverage. Please review.

Project coverage is 74.89%. Comparing base (0e6f9c3) to head (f16a68f).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
api/publish.go 59.09% 13 Missing and 5 partials ⚠️
api/snapshot.go 28.57% 10 Missing and 5 partials ⚠️
api/repos.go 40.00% 8 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1380      +/-   ##
==========================================
+ Coverage   74.84%   74.89%   +0.04%     
==========================================
  Files         151      151              
  Lines       17161    17161              
==========================================
+ Hits        12845    12852       +7     
+ Misses       3292     3284       -8     
- Partials     1024     1025       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@neolynx neolynx merged commit 767bc6b into master Oct 22, 2024
47 of 48 checks passed
@neolynx neolynx deleted the fix/concurrent-api branch October 22, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Ready for review & merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lost packages after publication
2 participants