Added Monitor Mode
This commit is contained in:
parent
8cb6c2d65b
commit
397f5ebadd
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue