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

total_rows is not consistent between worker threads and main thread #6055

Closed
nolanlawson opened this issue Dec 22, 2016 · 2 comments
Closed
Assignees
Labels
bug Confirmed bug

Comments

@nolanlawson
Copy link
Member

There's an in-memory cache for total_rows (aka doc_count) in the IDB adapter. This is cute and has some perf benefits, but it also introduces inconsistencies between the worker thread and main thread because we're caching stuff in-memory, outside of the IDB transaction.

Given the increasing usage of web workers and service workers, I don't think this is a safe tradeoff to make anymore. We should just remove this optimization and look for other, safer optimizations.

@nolanlawson nolanlawson added the bug Confirmed bug label Dec 22, 2016
@nolanlawson
Copy link
Member Author

Technically you can also reproduce this by just using the same PouchDB in multiple tabs, so it's not safe for that case either.

nolanlawson added a commit that referenced this issue Dec 23, 2016
Removes this unsafe optimization.
nolanlawson added a commit that referenced this issue Dec 23, 2016
Removes this unsafe optimization.
@nolanlawson nolanlawson self-assigned this Dec 23, 2016
nolanlawson added a commit that referenced this issue Dec 23, 2016
Removes this unsafe optimization.
nolanlawson added a commit that referenced this issue Dec 24, 2016
Removes this unsafe optimization.
daleharvey pushed a commit that referenced this issue Dec 26, 2016
Removes this unsafe optimization.
daleharvey pushed a commit that referenced this issue Dec 26, 2016
@nolanlawson
Copy link
Member Author

Fixed now

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

No branches or pull requests

1 participant