Periodic snapshot refresh#21504
Conversation
| error, | ||
| }); | ||
| this._refreshSnapshotP = undefined; | ||
| this.tryRefreshSnapshot(); |
There was a problem hiding this comment.
is there anything preventing this from overlapping with the timer? do we do anything make sure only 1 tryRefreshSnapshot is ever happening at once?
There was a problem hiding this comment.
i would probably just skip this, and rely on the driver to retry and suceed, and if it fails it will happen again when the timer triggers again,
There was a problem hiding this comment.
I believe by removing this tryRefreshSnapshot and blocking when latestSnapshot is set should be enough to prevent overlapping but I can wrap this function on a runSingle
There was a problem hiding this comment.
I believe the runSingle approach doesn't work since tryRefreshSnapshot is not async. Conditions should be sufficient to prevent reentrancy.
This change triggers fetching the latest snapshot in the serializedStateManager after a timeout established by config provider. Once that is complete, ssm will try to update the base snapshot if the already given conditions are met. Such timer is initialized in three different scenarios:
The scenario in which we load from a container with pending state is already covered by current code.
Here are some scenarios this change is covering, explaining its behavior:
Current conditions to update the snapshot should be sufficient since the most complicated case (while loading with pending state) is already covered.