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

Push more outgoing syncs in parallel

This commit is contained in:
Nigel Williams 2020-02-17 09:30:15 +11:00
parent 18ced7b6e7
commit 2217c0a4be
No known key found for this signature in database
GPG Key ID: 669BF2ED84BDDE8B

View File

@ -305,12 +305,11 @@ class SyncLib
} }
$this->db->closeCursor($server_res); $this->db->closeCursor($server_res);
/* add one entry for each server we're going to sync */ $num_per_server = 4;
/* add up to n entries for each server we're going to sync */
foreach ($server_list as $server) { foreach ($server_list as $server) {
$entry = array_shift($server); $items = array_slice($server, 0, $num_per_server);
if(count($server) == 0) { foreach ($items as $entry) {
unset($server_list[$entry['server']]);
}
$handle = $ch[$entry['server']]; $handle = $ch[$entry['server']];
$this->log(LOG_INFO, "server=" . $entry['server'] . ", server_nonce=" . $entry['server_nonce'] . ", info=" . $entry['info']); $this->log(LOG_INFO, "server=" . $entry['server'] . ", server_nonce=" . $entry['server_nonce'] . ", info=" . $entry['info']);
@ -321,6 +320,12 @@ class SyncLib
curl_multi_add_handle($mh, $handle); curl_multi_add_handle($mh, $handle);
$handles++; $handles++;
} }
$empty = array();
array_splice($server, 0, $num_per_server, $empty);
if(count($server) == 0) {
unset($server_list[$entry['server']]);
}
}
while($handles > 0) { while($handles > 0) {
while (curl_multi_exec($mh, $active) == CURLM_CALL_MULTI_PERFORM); while (curl_multi_exec($mh, $active) == CURLM_CALL_MULTI_PERFORM);