File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,6 @@ public function stop(int $signo = null)
237237 else {
238238 $ this ->running = false ;
239239 $ pool = $ this ->getDispatcher ()->getPool ();
240- $ pool ->checkChilds ();
241240 if ($ pool ->hasChilds () || $ pool ->hasQueue ()){
242241 print ("Waiting for handlers to finish... " .PHP_EOL );
243242 $ pool ->wait ();
@@ -257,8 +256,14 @@ protected function restartOnChanges(){
257256 }
258257 else {
259258 @cli_set_process_title ("NovaGram: died process ( {$ this ->getUsername ()}) " );
260- shell_exec (PHP_BINARY ." $ path " );
259+ system (PHP_BINARY ." $ path " );
260+ for ($ i = 0 ; $ i < 100 ; $ i ++){
261+ $ this ->logger ->error ('Bot crashed, trying to restart ' );
262+ system (PHP_BINARY ." $ path " );
263+ sleep (2 );
264+ }
261265 }
266+ $ this ->logger ->critical ('Bot crashed 100 times, stopped ' );
262267 exit ();
263268 }
264269 }
You can’t perform that action at this time.
0 commit comments