-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Trigger replication on appstate changes and realtime events #1278
feat: Trigger replication on appstate changes and realtime events #1278
Conversation
b2a3b4e
to
b87dafb
Compare
f50d62d
to
11582fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
offlineDoctypes.forEach(doctype => { | ||
realtime.subscribe('created', doctype, triggerReplicationCreated) | ||
realtime.subscribe('updated', doctype, triggerReplicationUpdated) | ||
realtime.subscribe('deleted', doctype, triggerReplicationDeleted) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize we trigger a full replication on all doctypes for any realtime change, while we probably should only replicate for the concerned doctype, to save resources. But this is an improvement that can be made for later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we will have to implement something to handle that scenario. For now the replication method always replicate all pouches and no mechanism has been implemented to debounce replications separately.
b87dafb
to
813e264
Compare
11582fc
to
77c1030
Compare
With previous PouchDB/offline implementation, the app was able to trigger a full replication on application's startup, but then nothing would be replicating until next app's restart
This PR is responsible to implement 2 new scenario:
For both scenario, the replication is debounced for 30s with a maximum of 10min