Refactor exponential backoff sleep duration in concurrency handling for improved accuracy
This commit is contained in:
parent
b6237a32d4
commit
b3790e6b0a
1 changed files with 1 additions and 1 deletions
|
|
@ -67,7 +67,7 @@ void SweepstoreConcurrency::spawnTicket(std::string filePath,
|
||||||
int count = expSleepTracker[label]; // defaults to 0 if not found
|
int count = expSleepTracker[label]; // defaults to 0 if not found
|
||||||
int sleepTime = (1 << count); // Exponential backoff
|
int sleepTime = (1 << count); // Exponential backoff
|
||||||
sleepTime = std::max(1, std::min(sleepTime, 1000)); // Clamp between 1ms and 1000ms
|
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;
|
expSleepTracker[label] = count + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue