File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 7
7
use Mammatus \LifeCycleEvents \Shutdown ;
8
8
use Mammatus \Queue \Generated \AbstractList ;
9
9
use Psr \Log \LoggerInterface ;
10
+ use React \EventLoop \Loop ;
10
11
use Throwable ;
11
12
use WyriHaximus \Broadcast \Contracts \Listener ;
12
13
use WyriHaximus \PSR3 \ContextLogger \ContextLogger ;
@@ -30,7 +31,8 @@ public function stop(Shutdown $event): void
30
31
31
32
public function run (string $ className ): int
32
33
{
33
- return await (async (function (string $ className ): int {
34
+ $ exitCode = 2 ;
35
+ async (function (string $ className ): int {
34
36
$ logger = new ContextLogger ($ this ->logger , ['worker ' => $ className ]);
35
37
try {
36
38
$ promises = [];
@@ -52,6 +54,12 @@ public function run(string $className): int
52
54
}
53
55
54
56
return $ exitCode ;
55
- })($ className ));
57
+ })($ className )->then (static function (int $ resultingExitCode )use (&$ exitCode ): void {
58
+ $ exitCode = $ resultingExitCode ;
59
+ });
60
+
61
+ Loop::run ();
62
+
63
+ return $ exitCode ;
56
64
}
57
65
}
You can’t perform that action at this time.
0 commit comments