Skip to content

Remove initialization state from the SNTP service#51

Merged
buildbreaker merged 1 commit intolyft:masterfrom
arturdryomov:ad/sntp-state
Nov 23, 2020
Merged

Remove initialization state from the SNTP service#51
buildbreaker merged 1 commit intolyft:masterfrom
arturdryomov:ad/sntp-state

Conversation

@arturdryomov
Copy link
Copy Markdown
Contributor

Upstreaming an internal change authored by @buildbreaker (internal #60231).

The app does a sync almost immediately after app launch. The state is almost always set to SYNCING before the get is called. This means that the INIT comparison is always false so the boot time check will never be triggered.

This should fix a large class of issues related to NTP. Specifically, if the user restarts their phone and then opens the app in poor network connectivity, they'll likely fail all the NTP requests and will be stuck using the persisted NTP time. Since the user restarted their app, the calculations for response age would be completely off (since the current elapsed ticks would always be lower than the elapsed ticks in the persistence).

Finally, we only do NTP syncs on an app open so if this were to trigger on a specific session, the rest of the session's timestamps would be off too.

PTAL @buildbreaker, @ameliariely, @amphora001

Copy link
Copy Markdown

@buildbreaker buildbreaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thank you for upstreaming this change!

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

Successfully merging this pull request may close these issues.

2 participants