-
Notifications
You must be signed in to change notification settings - Fork 5
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
Is it possible that the _changes subscription pool holds two _changes subscriptions to the same database? #15
Comments
https://github.com/hoodiehq/hoodie-plugins-manager/blob/master/lib/task_manager.js#L39 suggests that a source can only be subscribed once, but I’m not sure if that covers my case, or whether that has a bug. I’m open for other theories, too :) |
@janl the design is that it would only subscribe once to each source - whether or not that happens in reality is another question |
Hehe right :) My thinking is maybe that on two Not sure if this is thwarted by node's single-threadedness, though.
|
isSubscribed is synchronous, so that should be ok... however, there will be an async call between a db_updates event and requesting the changes from the server. It's possible that with two db_updates events in quick succession we'd request the same set of _changes twice. Looking at the code though, I think it would put the changes request into the updated queue and any subsequent requests would not queue another update until it is placed back into the idle pool. |
Perhaps we should come up with a test which fires db_updates events in quick succession and see what happens... |
@caolan would that be a case of calling |
I’m investigating an issue where emails get sent twice via the email plugin.
I get an error log presumably after the second time the emails got sent, the plugin tries to updated the task document, but fails, because the doc is already is deleted.
I have not fully grokked
changes_pool.js
andtask_manager.js
yet, so I am asking stupid questions :)To me it looks like a task is picked up twice and now I am looking how that can happen. I can confirm that there are no server restarts in between the sending of the emails.
One theory would be that it is possible for a database to have two changes listeners. It might be that
changes_pool.js
reduplicates already, but I haven’t gotten to verify or falsify that assumption, hence my question to @caolan :)The text was updated successfully, but these errors were encountered: