From: vincent@cubedesigners.com Date: Fri, 25 Aug 2023 12:02:24 +0000 (+0000) Subject: wait #6216 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f6a9d5dbca72e2b545ee360b2c342c5a9813c4d7;p=cubeextranet.git wait #6216 @1 --- diff --git a/.docker/config/cron/crontab b/.docker/config/cron/crontab index 5113fbc0b..22548a35d 100644 --- a/.docker/config/cron/crontab +++ b/.docker/config/cron/crontab @@ -7,6 +7,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 0 5 * * * root /usr/bin/lynx --dump https://workshop.fluidbook.com/maintenance/cleanCompiledBooks >/dev/null 2>/dev/null 40 * * * * root /usr/bin/lynx --dump https://workshop.fluidbook.com/maintenance/cleanPackages >/dev/null 2>/dev/null 0 1 * * * root /usr/bin/lynx --dump https://workshop.fluidbook.com/maintenance/cleanConversionSessions >/dev/null 2>/dev/null +* * * * * root /usr/bin/lynx --dump https://workshop.fluidbook.com/maintenance/pingFarm >/dev/null 2>/dev/null */5 * * * * root /application/bin/fixpackagerrights >/dev/null 2>/dev/null 35 3 * * * root /application/bin/compresslogs >/dev/null 2>/dev/null 10 * * * * root /application/bin/cleantmp >/dev/null 2>/dev/null diff --git a/inc/ws/Controlleur/class.ws.maintenance.php b/inc/ws/Controlleur/class.ws.maintenance.php index c8ca06a9e..736ddce84 100644 --- a/inc/ws/Controlleur/class.ws.maintenance.php +++ b/inc/ws/Controlleur/class.ws.maintenance.php @@ -1,5 +1,8 @@ sendRequest(wsDocument::getFCGIConnexion($server, 5), new PostRequest('ping.php', http_build_query([])))->getBody()); + if ($response == '1') { + $res[] = $server; + } + } catch (Exception $e) { + + } + } + file_put_contents(WS_CACHE . '/farmservers', json_encode($res)); + + } } diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 606716afd..84f138f99 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -450,7 +450,7 @@ class wsDocument extends cubeMetier public static function getFarmServers() { if (null === self::$_farmServers) { - self::$_farmServers = json_decode(file_get_contents('/data/toolbox/storage/fluidbookfarm/servers'), true); + self::$_farmServers = json_decode(file_get_contents(WS_CACHE . '/farmservers'), true); } return self::$_farmServers; @@ -459,16 +459,11 @@ class wsDocument extends cubeMetier public static function pickOneFarmServer($region = 'UE') { $hat = []; - $pings = json_decode(file_get_contents('/data/toolbox/storage/fluidbookfarm/servers')); $allServers = []; $regionServers = []; foreach (self::getFarmServers() as $k => $farmServer) { - if (!isset($pings[$k]) || !$pings[$k]) { - continue; - } - $allServers[$k] = $farmServer['weight']; if ($region == $farmServer['region']) { $regionServers[$k] = $farmServer['weight'];