Skip to content
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

.anyOf query return is inconsistent but .bulkGet works #1959

Open
frankleng opened this issue Apr 16, 2024 · 1 comment
Open

.anyOf query return is inconsistent but .bulkGet works #1959

frankleng opened this issue Apr 16, 2024 · 1 comment

Comments

@frankleng
Copy link

frankleng commented Apr 16, 2024

is there any difference in the concurrency logic for bulkGet and where('id').anyOf([...])?

it seems like anyOf has some sort of debounce that suffers from a race condition.
if we call .anyOf rapidly the final result may not be current. it works if we add a short delay between each call.

.bulkGet does not suffer from this, but I'd like to use anyOf so we can sort

@frankleng frankleng changed the title .anyOf query return is inconsistent but bulkGet works fine .anyOf query return is inconsistent but .bulkGet works Apr 16, 2024
@dfahlander
Copy link
Collaborator

anyOf uses an IDBCursor to iterate results sequencially in index order while bulkGet executes multiple calls to IDBObjectStore.get() in parallel.

AnyOf has been almost untouched for 8 years. There have been shaky bugs in the Safari implementation of IDBCursor historically but for the last 3-4 years or so, I haven't heard of any race-condition bugs in IDBCursor particularly.

Would it be possible to create a reproduction of the issue in jsfiddle or similar? That would help a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants