{
$originalConnectionTimeout = ini_get('default_socket_timeout');
ini_set('default_socket_timeout', 5);
+ $cache = WS_CACHE . '/farmpings';
+ $servers = wsDocument::getFarmServers();
$pings = [];
- foreach (wsDocument::getFarmServers() as $id => $farmer) {
+ if (file_exists($cache)) {
+ $cached = json_decode(file_get_contents($cache));
+ if (count($cached) === count($servers)) {
+ $pings = $cached;
+ }
+ }
+
+ foreach ($servers as $id => $farmer) {
+ if (isset($pings[$id]) || !$pings[$id]) {
+ // If ping failed recently, we wait a bit before trying again.
+ if (rand(0, 9) === 5) {
+ continue;
+ }
+ break;
+ }
echo '<h2>' . $farmer['host'] . ' (' . $id . ')</h2>';
$cl = new CubeIT_CommandLine('/usr/local/fluidbook_processfarm/bin/ping');
$cl->setSSH($farmer['host'], 'fluidbookfarmer', '', $farmer['port'] ?? 22, '/home/extranet/.ssh/id_rsa');
$pings[$id] = $ok;
}
- file_put_contents(WS_CACHE . '/farmpings', json_encode($pings));
+ file_put_contents($cache, json_encode($pings));
ini_set('default_socket_timeout', $originalConnectionTimeout);
}
['svg', '150', true, false, 'html'],
['svg', '300', true, false, 'html'],
['svg', '150', true, true, 'html'],
- ['svg', '200', true, true, 'html'],
+ ['svg', '300', true, true, 'html'],
];
foreach ($files as $file) {