You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At some situation i need add Timer at master process, but it look like imposible because master have monitorWorkersForLinux method with pcntl_wait function what will be block master process until worker will not shutdown or master will get somу signal. While it was blocking no one Event library can't run timer...but...
Some Event library has own pcntl_wait analogs , like Swoole\Coroutine\System::wait in Swoole (https://wiki.swoole.com/#/coroutine/system?id=wait). It will do same things as pcntl_wait but additional Timer can be work in master process
Is it possible change monitorWorkersForLinux $pid = \pcntl_wait($status, \WUNTRACED);->static::$globalEvent->wait() ? And EventInterface need be abstract with share method wait by default have pcntl_wait (except Swoole) and return array ['pid'=>$pid, 'signal'=>$status] (like a Swoole\Coroutine\System::wait return array's format) or stay like Interface but need have abstract method wait():array (but in this realisation each Event need wait method with pcntl_wait except Swoole)
Because not it impossible change monitorWorkersForLinux by extends class , because it have private property , additionaly this method have a lot of code, but only need change one line of code
Workerman support timer in the master process, and the code is similar to this
$worker = new Worker('http://0.0.0.0:1234');
// The timer will only run in master process
Timer::add(1, function() {
echo "hello";
});
Worker::runAll();
take care
The timer of the main process only supports second level.
It is not recommended to initialize database or Redis resource class connections in the main process, as these connection resources may be inherited by child processes, leading to unforeseen problems
At some situation i need add Timer at master process, but it look like imposible because master have
monitorWorkersForLinux
method withpcntl_wait
function what will be block master process until worker will not shutdown or master will get somу signal. While it was blocking no one Event library can't run timer...but...Some Event library has own
pcntl_wait
analogs , likeSwoole\Coroutine\System::wait
in Swoole (https://wiki.swoole.com/#/coroutine/system?id=wait). It will do same things aspcntl_wait
but additional Timer can be work in master processIs it possible change
monitorWorkersForLinux
$pid = \pcntl_wait($status, \WUNTRACED);
->static::$globalEvent->wait()
? And EventInterface need be abstract with share methodwait
by default havepcntl_wait
(except Swoole) and return array['pid'=>$pid, 'signal'=>$status]
(like aSwoole\Coroutine\System::wait
return array's format) or stay like Interface but need have abstract methodwait():array
(but in this realisation each Event needwait
method withpcntl_wait
except Swoole)Because not it impossible change
monitorWorkersForLinux
by extends class , because it have private property , additionaly this method have a lot of code, but only need change one line of code@walkor
The text was updated successfully, but these errors were encountered: