Refactor exponential backoff sleep duration in concurrency handling for improved accuracy

This commit is contained in:
ImBenji
2025-12-02 14:40:53 +00:00
parent b6237a32d4
commit b3790e6b0a

View File

@@ -67,7 +67,7 @@ void SweepstoreConcurrency::spawnTicket(std::string filePath,
int count = expSleepTracker[label]; // defaults to 0 if not found
int sleepTime = (1 << count); // Exponential backoff
sleepTime = std::max(1, std::min(sleepTime, 1000)); // Clamp between 1ms and 1000ms
preciseSleep(std::chrono::microseconds(sleepTime * 5000));
preciseSleep(std::chrono::milliseconds(sleepTime));
expSleepTracker[label] = count + 1;
};