fix
This commit is contained in:
@ -184,8 +184,11 @@ auto lock_data::wait_for_lock(int fd, std::uint8_t retry_count) -> int {
|
|||||||
if (lock_status == -1) {
|
if (lock_status == -1) {
|
||||||
lock_status = errno;
|
lock_status = errno;
|
||||||
if (lock_status == EWOULDBLOCK) {
|
if (lock_status == EWOULDBLOCK) {
|
||||||
auto sleep_ms =
|
auto sleep_ms = std::min(remain, max_sleep);
|
||||||
utils::generate_random_between(1U, std::min(remain, max_sleep));
|
if (sleep_ms > 1U) {
|
||||||
|
sleep_ms = utils::generate_random_between(1U, sleep_ms);
|
||||||
|
}
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(sleep_ms));
|
std::this_thread::sleep_for(std::chrono::milliseconds(sleep_ms));
|
||||||
remain -= sleep_ms;
|
remain -= sleep_ms;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user