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
Loading
Please register or sign in to comment