tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit bfc41c41a0ff386707354dc6cc467b9699373349
parent 42620de69c1c68282f9dd5cdb7c08fe11e41a7f9
Author: Florian Quèze <florian@queze.net>
Date:   Thu,  2 Oct 2025 19:28:47 +0000

Bug 1991018 - use exponential backoff for sleeps in OpenDatabaseAndHandleBusy, r=dom-storage-reviewers,janv,asuth,hsingh.

Differential Revision: https://phabricator.services.mozilla.com/D266296

Diffstat:
Mdom/indexedDB/ActorsParent.cpp | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp @@ -785,8 +785,15 @@ OpenDatabaseAndHandleBusy(mozIStorageService& aStorageService, // that to complete. const TimeStamp start = TimeStamp::NowLoRes(); + // Use exponential backoff: start at 1ms, double up to 100ms max + uint32_t sleepMs = 1; + constexpr uint32_t kMaxSleepMs = 100; + do { - PR_Sleep(PR_MillisecondsToInterval(100)); + PR_Sleep(PR_MillisecondsToInterval(sleepMs)); + + // Exponential backoff with cap + sleepMs = std::min(sleepMs * 2, kMaxSleepMs); QM_TRY_UNWRAP(connection, QM_OR_ELSE_WARN_IF(