Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9471183 authored by Olivier Gaillard's avatar Olivier Gaillard Committed by Automerger Merge Worker
Browse files

Merge "Make rate limiting less aggressive for recurrent crashes" into udc-dev...

Merge "Make rate limiting less aggressive for recurrent crashes" into udc-dev am: dab9fe86 am: a4084256

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23285877



Change-Id: Ia4a752d6391c735867ef7e955010b88b17c5c1f7
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 64f0955e a4084256
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public class DropboxRateLimiter {
    // If a process is rate limited twice in a row we consider it crash-looping and rate limit it
    // more aggressively.
    private static final int STRICT_RATE_LIMIT_ALLOWED_ENTRIES = 1;
    private static final long STRICT_RATE_LIMIT_BUFFER_DURATION = 60 * DateUtils.MINUTE_IN_MILLIS;
    private static final long STRICT_RATE_LIMIT_BUFFER_DURATION = 20 * DateUtils.MINUTE_IN_MILLIS;

    @GuardedBy("mErrorClusterRecords")
    private final ArrayMap<String, ErrorRecord> mErrorClusterRecords = new ArrayMap<>();
+5 −5
Original line number Diff line number Diff line
@@ -140,19 +140,19 @@ public class DropboxRateLimiterTest {
        // Repeated crashes after the last reset being rate limited should be restricted faster.
        assertTrue(mRateLimiter.shouldRateLimit("tag", "process").shouldRateLimit());

        // We now need to wait 61 minutes for the buffer should be empty again.
        mClock.setOffsetMillis(83 * 60 * 1000);
        // We now need to wait 21 minutes for the buffer should be empty again.
        mClock.setOffsetMillis(43 * 60 * 1000);
        assertFalse(mRateLimiter.shouldRateLimit("tag", "process").shouldRateLimit());

        // After yet another 61 minutes, this time without triggering rate limiting, the strict
        // After yet another 21 minutes, this time without triggering rate limiting, the strict
        // limiting should be turnd off.
        mClock.setOffsetMillis(144 * 60 * 1000);
        mClock.setOffsetMillis(64 * 60 * 1000);
        assertFalse(mRateLimiter.shouldRateLimit("tag", "process").shouldRateLimit());
        assertFalse(mRateLimiter.shouldRateLimit("tag", "process").shouldRateLimit());

        // As rate limiting was not triggered in the last reset, after another 11 minutes the
        // buffer should still act as normal.
        mClock.setOffsetMillis(155 * 60 * 1000);
        mClock.setOffsetMillis(75 * 60 * 1000);
        // The first 6 entries should not be rate limited.
        assertFalse(mRateLimiter.shouldRateLimit("tag", "process").shouldRateLimit());
        assertFalse(mRateLimiter.shouldRateLimit("tag", "process").shouldRateLimit());