1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2024-11-29 00:24:13 +01:00

Recalculate sleep time based on how long we spent processing.

This commit is contained in:
Benno Rice 2019-10-22 15:06:16 +11:00
parent 6c60b1f3a7
commit b005c37539

View File

@ -54,6 +54,9 @@ if ($sl->getNumberOfServers() === 0 && $sl->getQueueLength() === 0)
# Loop forever and resync
do {
$sl->reSync($baseParams['__YKVAL_SYNC_OLD_LIMIT__'],
$baseParams['__YKVAL_SYNC_RESYNC_TIMEOUT__']);
} while(sleep($baseParams['__YKVAL_SYNC_INTERVAL__'])==0);
$start = time();
$sl->reSync($baseParams['__YKVAL_SYNC_OLD_LIMIT__'],
$baseParams['__YKVAL_SYNC_RESYNC_TIMEOUT__']);
$duration = time() - $start;
$sleep_time = max($baseParams['__YKVAL_SYNC_INTERVAL__'] - $duration, 0);
} while(sleep($sleep_time)==0);