Updated \TamerLib > tm > monitor() to do it's own loop for a indefinite timeout.

This commit is contained in:
Netkas 2023-06-16 02:30:08 -04:00
parent 44b554d08c
commit f85c0e7e5d
No known key found for this signature in database
GPG key ID: 5DAF58535614062B

View file

@ -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;
}
}
}
}