Skip to content
Commit 65613985 authored by Neil Fuller's avatar Neil Fuller
Browse files

Prevent undesirable scheduling behavior

Avoid a case discovered by inspection.

Before this commit:

If the most recent time result is too old, every call to
refreshIfRequiredAndReschedule() will result in a refresh attempt until
one is successful. These calls can happen for reasons besides a
scheduled refresh, e.g. if the network connectivity changes. These
shouldn't happen often, but it not good to allow unrestricted server
load if the servers are down or unreachable.

After this commit:

This commit adds a minimum time between refresh attempts. This means
that refreshIfRequiredAndReschedule() may not result in a refresh. The
next scheduled refresh is still based on when the last refresh was
attempted.  This commit adds a test to demonstrate the new behavior.

All existing tests are unaffected.

Bug: 222295093
Test: atest services/tests/servicestests/src/com/android/server/timedetector/NetworkTimeUpdateServiceTest.java
Change-Id: Ife0c0b4826999525a8937e35168723e9b44c42dc
parent 469925d2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment