Refactor exponential backoff sleep duration in concurrency handling for improved accuracy
This commit is contained in:
@@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user