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

worker: Add DEDUPLICATED flag to the BackgroundJob trait #9627

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Oct 11, 2024

This flag can be set when implementing background jobs to automatically deduplicate jobs when they are enqueued. If an unstarted job already exists in the queue the enqueue() fn will return Ok(None) instead of the job ID.

This should allow us to get rid of enqueue_sync_to_index() as a special case and make the same functionality available to other jobs as well.

This flag can be set when implementing background jobs to automatically deduplicate jobs when they are enqueued. If an unstarted job already exists in the queue the `enqueue()` fn will return `Ok(None)` instead of the job ID.
@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels Oct 11, 2024
@Turbo87 Turbo87 requested a review from a team October 11, 2024 10:29
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.88%. Comparing base (f7d0fd8) to head (a13e915).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9627      +/-   ##
==========================================
+ Coverage   88.84%   88.88%   +0.03%     
==========================================
  Files         289      289              
  Lines       29146    29232      +86     
==========================================
+ Hits        25895    25982      +87     
+ Misses       3251     3250       -1     

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

Copy link
Contributor

@LawnGnome LawnGnome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a few minutes where you could hear the gears grinding in my head to suss out the deduplicated query, but now my brain has kicked in, LGTM. 👍

@Turbo87 Turbo87 merged commit 6066d18 into rust-lang:main Oct 11, 2024
10 checks passed
@Turbo87 Turbo87 deleted the dedupe branch October 11, 2024 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants