1313use FastLaravel \Http \Process \HotReload ;
1414use FastLaravel \Http \Database \ConnectionResolver ;
1515use FastLaravel \Http \Facade \Show ;
16+ use FastLaravel \Http \Server \Event ;
1617use Illuminate \Contracts \Container \Container ;
1718use Illuminate \Contracts \Debug \ExceptionHandler ;
1819
@@ -264,7 +265,7 @@ protected function createTracker()
264265 */
265266 public function onStart ($ server )
266267 {
267- $ this ->container ->make ('events ' )->dispatch (' start ' , func_get_args ());
268+ $ this ->container ->make ('events ' )->dispatch (Event:: START , func_get_args ());
268269 $ this ->setProcessName ('master process ' );
269270 $ this ->createPidFile ();
270271 if (isTesting ()) {
@@ -282,19 +283,20 @@ public function onStart($server)
282283 */
283284 public function onManagerStart ($ server )
284285 {
285- $ this ->container ->make ('events ' )->dispatch (' managerStart ' , func_get_args ());
286+ $ this ->container ->make ('events ' )->dispatch (Event:: MANAGER_START , func_get_args ());
286287 $ this ->setProcessName ('manager process ' );
287288 }
288289
289290 /**
290291 * "onWorkerStart" callback.
291292 *
292293 * @param HttpServer $server
294+ * @param int $workerId
293295 * @throws
294296 */
295- public function onWorkerStart ($ server )
297+ public function onWorkerStart ($ server, $ workerId )
296298 {
297- $ this ->container ->make ('events ' )->dispatch (' workerStart ' , func_get_args ());
299+ $ this ->container ->make ('events ' )->dispatch (Event:: WORKER_START , func_get_args ());
298300 $ this ->clearCache ();
299301
300302 // init laravel app in task workers
@@ -417,23 +419,36 @@ public function onTaskCo(HttpServer $server, $task)
417419
418420 /**
419421 * Set onFinish callback.
422+ * @param HttpServer $server
423+ * @param int $taskId
424+ * @param string $data
425+ * @throws
420426 */
421- public function onFinish (HttpServer $ server , $ taskId , $ data )
427+ public function onFinish ($ server , $ taskId , $ data )
422428 {
429+ $ this ->container ->make ('events ' )->dispatch (Event::FINISH , func_get_args ());
423430 }
424431
425432 /**
426433 * Set onWorkerStop callback.
434+ *
435+ * @param HttpServer $server
436+ * @param int $workerId
437+ * @throws
427438 */
428- public function onWorkerStop ()
439+ public function onWorkerStop ($ server , $ workerId )
429440 {
441+ $ this ->container ->make ('events ' )->dispatch (Event::WORKER_STOP , func_get_args ());
430442 }
431443
432444 /**
433445 * Set onShutdown callback.
446+ * @param HttpServer $server
447+ * @throws
434448 */
435- public function onShutdown ()
449+ public function onShutdown ($ server )
436450 {
451+ $ this ->container ->make ('events ' )->dispatch (Event::SHUTDOWN , func_get_args ());
437452 $ this ->removePidFile ();
438453 }
439454
0 commit comments