"...0d0cea2424ae97b27447dc64a7dbfae83c036c45b403392f0e8ba.png" did not exist on "29c2634a1576390887bd735d4caead80297ba9cf"
Throttle package session async write requests
Previously, async writes were posted to a Handler but not throttled, so it was possible to do redundant writes when the latest state had already been saved. To avoid that, a counter is stored that serves as a request ID that can be checked against to see if the latest state has already been saved, skipping the write request if it has. This is preferred to calling Handler#hasCallbacks or Handler#removeCallbacks because those will lock the Handler. And taking the lock twice is perhaps worse than locking once to schedule a no-op Runnable, although this was not benchmarked. This also introduces a retry mechanism in case the write fails. Bug: 168086110 Test: atest PackageSessionTests Test: atest RequestThrottleTest Change-Id: I604dc433c77cf1d9d743c8437674576ad087d62c
Loading
Please register or sign in to comment