rocicorp / replicache-sdk-flutter

Replicant SDK for Flutter
https://replicache-sdk-flutter.now.sh/
Other
6 stars 1 forks source link

Mutations created while a sync is in progress take a long time to sync #94

Open aboodman opened 4 years ago

aboodman commented 4 years ago

If you create a mutation while a sync is running in the sample app, it isn't pushed until the next sync interval, which is currently set to 1m.

The reason is because we ignore calls to sync that happen while a sync is already running. And once sync is done, we don't check again to see if sync should run again.

I don't know of a correct way to implement this without either (a) exposing through bindings the concept of pending mutations, or (b) simply doing it implicitly inside repm.

aboodman commented 4 years ago

cc @phritz

arv commented 4 years ago

Since the bindings already know how to initiate a sync the cleanest way to solve this is to have sync return a flag telling the bindings to start a sync soon.