-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
replicationState.active$ emits false after pending changes have synced #763
Comments
From the code, the active$-state is just a mapping to the // active
this._subs.push(
fromEvent(evEmitter, 'active')
.subscribe(() => this._subjects.active.next(true))
);
this._subs.push(
fromEvent(evEmitter, 'paused')
.subscribe(() => this._subjects.active.next(false))
); Is it intentional by pouchdb to emit paused when the replication is finished? |
After some testing with pouch:
From all this, it wouldn't be adequate to derive Now, in order to know whether the connection is active/alive or not at any given time, we could add a new subscription - What do you think? |
Thank you for the investigation. I think your plan is good, lets split the observables into @rafamel I you have some spare time, a PR to the |
Hey @pubkey , sorry for the delay, I was on a weekend trip. I'll get on it! |
Hi @rafamel
This makes me assume that Can you check your described behavior with |
After some testing with [email protected] - here's the log:
Therefore, mapping So since active is not emitted occasionally anymore, for the use of the original events That leaves out two useful subscriptions to be implemented: whether there are pending changes to be pushed ( |
I am closing this since the original issue has been solved. |
Case
Possible bug/FR.
Issue
As per the docs replicationState.active$ "Emits true or false depending if the replication is running. For example if you sync with a remote server and the connection dies, this is false until the connection can be reestablished."
However, it doesn't hold a
true
value but rather turnsfalse
as soon as changes have been replicated.In the same way, when the connection to the remote database is lost,
replicationState.error$
doesn't emit any error.If this is intended behavior, I believe
$active
doesn't offer any further information to$completed
, and there is no way for us to know when the connection is active or lost in a reliable manner. In that case, this would be a FR for a subscription that allowed us to - other than manually checking whether recent changes have been synchronized.Info
The text was updated successfully, but these errors were encountered: