diff --git a/kernel/balancer_by_market_order.php b/kernel/balancer_by_market_order.php index ee55e9a..8ed87d1 100644 --- a/kernel/balancer_by_market_order.php +++ b/kernel/balancer_by_market_order.php @@ -1,6 +1,7 @@ poll(); - if ($common_config['send_ping_to_log_server'] && isset($discrete_time) && isset($log) && $discrete_time->proof()) { + if ($common_config['send_ping_to_log_server'] && isset($publisher) && isset($discrete_time) && isset($log) && $discrete_time->proof()) { if (isset($i)) { $i++; diff --git a/src/Aeron.php b/src/Aeron.php index af0e59a..9e230f9 100644 --- a/src/Aeron.php +++ b/src/Aeron.php @@ -2,6 +2,9 @@ namespace Src; +use Aeron\Publisher; +use Exception; + class Aeron { @@ -19,4 +22,29 @@ public static function messageDecode(string $message) } + public static function checkConnection(Publisher $publisher): void + { + + do { + + try { + + $publisher->offer('ping'); + + $do = false; + + } catch (Exception) { + + $do = true; + + echo '[' . date('Y-m-d H:i:s') . '] Try to connect Aeron' . PHP_EOL; + + sleep(1); + + } + + } while ($do); + + } + } \ No newline at end of file