-
Couldn't load subscription status.
- Fork 159
Description
Consider the following situation in a dynamic state sync:
There are two Syncers, A and B. Syncer A has a long Sync, but UpdateSyncTarget is really fast. Syncer B has a short Sync, but a long UpdateSyncTarget. We end up with the following sequence:
- Start both syncers
- Syncer B finishes
- UpdateSyncTarget is called
- Syncer A finishes, escaping the sync loop
- Syncer B finishes its UpdateSyncTarget
Since UpdateSyncTarget can be called after Sync returns, I think we should add one more method on the syncer: Finalize(ctx, target). It handles the finalization logic for each syncer (e.g. database commits), but will also verify that the data is correct and waits until all UpdateSyncTarget's finish.
While completing a resolution for this, it may be convenient to also consider resolving #1089