-
Notifications
You must be signed in to change notification settings - Fork 751
FOEPD-2119: Use SaveContext to write to DB in background thread #6389
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
2ae16c8
Add AsyncSaveContext that saves batches in background thread
exupero b77fda7
Capture futures and join on them before exiting async context manager
exupero 1534133
Lock save and _save_batch execution to avoid dropping samples
exupero dd407ef
Wait on final batch save from __exit__ and clear list of futures
exupero 021fbb5
Make locks more fine-grained to restore performance improvement
exupero fd2d307
Copy data and clear inside lock, don't lock slow I/O
exupero a68ba84
Loop-drain futures on AsyncSaveContext#__exit__()
exupero 6a7c668
Ensure executor is exited
exupero 6acf531
Drain all futures rather short-circuiting on error
exupero a451178
Don't mask error from 'with' body
exupero f9389c6
Merge AsyncSaveContext logic into SaveContext, behind async_writes=Tr…
exupero ed897c4
Fix logic to throw error when 'with' body didn't
exupero c5de0cc
Add 'async_writes' option to docstring
exupero bbf17de
Denote DummyFuture and DummyExecutor are private with leading _
exupero 9a1ef56
Remove unused exception var
exupero 2248a13
Fix comment
exupero 39c6da7
Add comment about not using more than one background thread
exupero 61b2028
Generalize comment
exupero 544d845
Make dummy future fail synchronously
exupero 21f2a91
Don't re-queue failed ops to avoid race conditions
exupero df54fa5
Clarify comment
exupero 2715936
Simplify comment so it doesn't assume how SaveContext is used
exupero 455ca3b
Clean out finished futures whenever a batch is saved
exupero 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.