Skip to content
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

Cache and "refresh" behavior not clear #36

Open
agforte opened this issue May 1, 2020 · 1 comment
Open

Cache and "refresh" behavior not clear #36

agforte opened this issue May 1, 2020 · 1 comment

Comments

@agforte
Copy link

agforte commented May 1, 2020

If the cacheExpirationMs is 1 minute and minWaitTimeBetweenSyncMs is 5 minutes, what will happen when I do a getCurrentTime() at minute 3? Will the value in the cache be used even though it is expired, will a sync be forced even though it still has 2 minutes left or will it just use the local device time?

@xgouchet
Copy link

xgouchet commented Aug 7, 2020

By the look of the code, even if the last update is out of date, it'll still wait for the 5 minutes to expire before starting a new sync.
The way this library works is by keeping in memory the difference between the local device time and the server time. Whenever you call getCurrentTime(), it will use this difference to return ASAP in a non blocking way, and will request a sync in the background if needed to ensure the difference is still accurate.

@iljaosintsev iljaosintsev mentioned this issue Aug 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants