-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implement ordered concurrency #31
Open
flying-scorpio
wants to merge
8
commits into
verdigado:main
Choose a base branch
from
flying-scorpio:ordered-concurrency
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2aa2626
Use PromisePool to add concurrency to users and rooms
flying-scorpio c19a9ad
Use a Map to assign messages to their corresponding room for processing
flying-scorpio 15cda97
Add types for the processing queues
flying-scorpio 78948bc
Use camelCase for new variables
flying-scorpio 9fa8e03
Move switch out of while loop, add loops for each case
flying-scorpio 64935fd
Move PromisePools inside each case
flying-scorpio 7a7fdec
Wrap lineByLine in iterator to remove queues
flying-scorpio bee1c2f
Handle messages in batches to avoid OOM kill
flying-scorpio 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.
Now I am thinking to move the
switch (entity)
outside and looping and handling the queue inside each caseThere 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.
Yes, threadmessages are handled just like any message, so the sequence is the same as from the RC export.
I converted the variables to camelCase. Thanks!
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've thought of it, but that would add as many loops as there are cases, not sure which of the two versions would be faster.
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.
As the function is called 3 times, each with one entity type, it would check 3 times and loop within it. We also don't need to check non-affected queues, then.
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.
In 9fa8e03,
64935fd
and 7a7fdec :
I moved the switch outside of the loop. For users and rooms, the loop is handled by the PromisePool, so no need to use queues anymore. For messages, to maintain the sequence, I kept the two steps of populating the Map and then loading.
Because
PromisePool
loops over an iterator, I added a wrapper to turnlineByLine
into an iterator (its.next()
method made me think it was implemented as an iterator, but it isn't).I feel the message handling can still be improved, maybe avoiding the first step of loading. To take care of #3 (comment), cut the messages in batches or something.
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 added batches for the message handling in bee1c2f.
Tested with: