-
Notifications
You must be signed in to change notification settings - Fork 2
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
DittoSyncStatusHelper #161
Comments
Didn't think about this until now, but could this be something that is part of the existing Health tool? |
@rajramsaroop That's a good question—should this tool be a My gut feeling is, "Yes, it makes sense," but I'd want to split that scope into a different story. |
@rajramsaroop I thought about it a bit more, and I couldn't figure out what would constitute a useful unhealthy state as a |
At the risk of bike-shedding, the names |
@dhaikney I think thats generally accurate, the intent was to provide as many convenience accessors as possible, and align to what we just shipped over in https://github.com/getditto/ditto_flutter_tools. We can revisit naming across all the platforms as long as we get it all lined up. |
Create a new tool - DittoSyncStatusHelper
This tool allows the user to pass in a list of subscriptions and a handler, to which the "status" of the set of subscriptions is delivered. This "status" is either
disconnected
,connectedIdle
orconnectedSyncing
:disconnected
means the presence graph has both noremotePeers
andlocalPeer.isConnectedToDittoCloud
isfalse
(tracked internally via anisConnected
bool updated by observing the presence graph)connectedIdle
means there have been no new query results for the set of subscriptions in the previousidleTimeoutInterval
, which defaults to 1 secondconnectedSyncing
means there has been at least one update to at least one subscription in the previousidleTimeoutInterval
, which defaults to 1 secondThe tool works by internally creating store observers matching each subscription passed in, and then tracking a
lastUpdated
date every time any results flow out of the observer, updating the date.For convenience, also provide the following timestamps:
becameConnectedAt
- the last time isConnected was truebecameDisconnectedAt
- the last time isConnected went from true to falselastConnectedAt
- the last time isConnected went from false to trueThere is one important caveat to this tool that we should clearly call out in the documentation:
connectedIdle
but not have the latest data. This will only come up in p2p sync scenarios, however, not when only doing cloud sync—any Big Peers would always be subscribed to everything.The text was updated successfully, but these errors were encountered: