-
Notifications
You must be signed in to change notification settings - Fork 106
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
De-dupe sync tasks #1346
De-dupe sync tasks #1346
Conversation
@@ -141,15 +141,32 @@ async function ensureStorageMiddleware (req, res, next) { | |||
* @dev - TODO move this out of middlewares to Services layer | |||
*/ | |||
async function triggerSecondarySyncs (req) { | |||
if (config.get('isUserMetadataNode') || config.get('snapbackDevModeEnabled')) return | |||
const { snapbackSM } = serviceRegistry |
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.
every change in this file is just code cleanup, except for line 165 (the enqueueSync()
call
primaryEndpoint, | ||
secondaryEndpoint, | ||
userWallet, | ||
primaryClockValue, |
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.
removing primaryClockValue
from job inputs since it is unrelated and it also makes it impossible to dedupe syncs effectively
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.
This PR is amazing 🙏
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.
Looks good
Merging despite mad-dog failure as it is the same 404 error and already tested on staging |
Description
What is the purpose of this PR? What is the current behavior? New behavior? Relevant links (e.g. Trello) and/or information pertaining to PR?
Spec in Notion
Problem: often see multiple syncs in queue for same user/secondary - this is redundant and takes spots away from other syncs
Solution: Bull provides no helpful API, so implemented an in-memory map to record progress syncs and prevent duplicate syncs from being enqueued.
Tests
List the manual tests and repro instructions to verify that this PR works as anticipated. Include log analysis if possible.
❗ If this change impacts clients, make sure that you have tested the clients ❗
Snapback integration & system tests passing
❗ Reminder 💡❗:
If this PR touches a critical flow (such as Indexing, Uploads, Gateway or the Filesystem), make sure to add the
requires-special-attention
label. Add relevant labels as necessary.