This repository was archived by the owner on Apr 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
feat: better requeue mechanism using a separate nonce channel #643
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
12cb6d9
feat: better requeue mechanism using a separate nonce
rach-id 0aaea39
Fix: correct condition
rach-id 1860596
Fix: correct go routine
rach-id fa8bd8d
Merge branch 'main' into requeue-sleep
rach-id 33aa69d
Merge branch 'main' into requeue-sleep
rach-id 09d1a97
Merge branch 'main' into requeue-sleep
rach-id File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can we just add this as a different case in the select/for loop?
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.
I don't want this to be blocking, that's why I added the condition. Also, we don't want to requeue every time so that we don't keep retry indefinitely the failing nonce, but instead do it once in an hour
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.
mind explaining how will it block? won't it only get triggered is something is pushed through the channel to the select statement? If it will block if noncesQueue is full, then imo we should either increase that buffer or empty the channel faster. I could be missing something ofc too
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.
perhaps the emptying and filling of the channel should not be in the same select statement?
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.
If nonces queue is full and we run:
it will block, and at the same time, it won't be able to process nonces because it will be stuck here, hence the use of the go routine.
Also, we're using the ticker so that the nonsense don't get processed every time they fail directly so that we give them an hour of a delay before they get re-processed.
we could and it would be cleaner, but didn't want to add that extra complexity.
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.
why not just put the nonce in the queue when we attempt to retry instead of putting it in a channel, which eventually gets added to the nonce channel
or if we need the extra protection for some reason we can have a single goroutine that is connecting the two channels.
this could just be me being too nit picky, but spinning up a single goroutine to connect two channels on a timer feels like there's room for improvement