Added Monitor Mode

This commit is contained in:
Netkas 2023-02-09 18:08:38 -05:00
parent 8cb6c2d65b
commit 397f5ebadd

View file

@ -311,6 +311,25 @@
}
}
/**
* Monitors the workers and restarts them if they die unexpectedly (monitor mode only)
*
* @param bool $auto_restart
* @return void
* @throws Exception
*/
public static function monitor(bool $auto_restart=false): void
{
if (self::$mode === Mode::Client)
{
self::$supervisor->monitor($auto_restart);
}
else
{
throw new InvalidArgumentException('Tamer is not running in client mode');
}
}
/**
* Adds a worker to the supervisor
*