Refactor preciseSleep for improved timing accuracy and reduce busy-wait duration on Windows
This commit is contained in:
@@ -39,7 +39,7 @@ void spawnTicket(RandomAccessFile file, {
|
||||
int count = expSleepTracker[label] ?? 0;
|
||||
int sleepTime = (1 << count); // Exponential backoff
|
||||
// sleepTime = max(1, min(sleepTime, 1000)); // Clamp between 1ms and 1000ms
|
||||
preciseSleep(Duration(microseconds: sleepTime * 5000));
|
||||
preciseSleep(Duration(microseconds: sleepTime * 1000));
|
||||
expSleepTracker[label] = count + 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user