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
|
@ -227,6 +227,8 @@
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function monitor(int $timeout=0): void
|
public static function monitor(int $timeout=0): void
|
||||||
|
{
|
||||||
|
if($timeout > 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -238,6 +240,28 @@
|
||||||
Log::error(Utilities::getName(), $e->getMessage(), $e);
|
Log::error(Utilities::getName(), $e->getMessage(), $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CLIENT FUNCTIONS
|
* CLIENT FUNCTIONS
|
||||||
|
|
Loading…
Add table
Reference in a new issue