Fix indexedDb driver so pending operations are resolved under concurrent worker threads #1019
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.
Hi, this is related to:
#1008
and
#1009
I am unfortunately unable to run tests against this locally, because the tests appear to be broken per the Issues board (I gave it my best shot, but I don't want to spend too much time on that if they're broken, we should also update the README to reflect they're broken at the moment if they're truly broken), so I'm hoping one of the long time maintainers can look at this and confirm this makes sense.
What this fixes is a race condition that can pop up in the indexedDb driver where operations may never complete when a new connection is setup for the exact same store. So e.g. if you construct two instances for the same storeName and version and they are created concurrently (with a worker thread and ur main thread) and both of those instances make pending requests, you can run into a situation where promises hang in the event loop.
So e.g calls such as getItem() never resolve. So yeah, generally not good. Any insight/a look over would be greatly appreciated.
Thanks for all the hard work people!
Best,
inF3Rnus