Updated \TamerLib > tm > monitor() to do it's own loop for a indefinite timeout.
This commit is contained in:
parent
44b554d08c
commit
f85c0e7e5d
1 changed files with 29 additions and 5 deletions
|
@ -228,14 +228,38 @@
|
|||
*/
|
||||
public static function monitor(int $timeout=0): void
|
||||
{
|
||||
try
|
||||
if($timeout > 0)
|
||||
{
|
||||
self::$supervisor?->monitor($timeout);
|
||||
self::$server?->monitor($timeout);
|
||||
try
|
||||
{
|
||||
self::$supervisor?->monitor($timeout);
|
||||
self::$server?->monitor($timeout);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
Log::error(Utilities::getName(), $e->getMessage(), $e);
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
else
|
||||
{
|
||||
Log::error(Utilities::getName(), $e->getMessage(), $e);
|
||||
$start_time = time();
|
||||
while(true)
|
||||
{
|
||||
try
|
||||
{
|
||||
self::$supervisor?->monitor(-1);
|
||||
self::$server?->monitor(-1);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
Log::error(Utilities::getName(), $e->getMessage(), $e);
|
||||
}
|
||||
|
||||
if(time() - $start_time >= $timeout)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue