From 93e96a044d28ffa61c4034bd2c1b88042b86df61 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 8 May 2026 19:36:12 +0100 Subject: [PATCH] Fix bus resolver to look up context container per dispatch The resources/context migration replaced the resolver closure with a first-class callable from `$swoole->context()->get(...)`. That captures the result of `$swoole->context()` once -- on the first dispatch -- and binds the bus to the first request's per-request container forever after. Wrap the lookup in a fresh closure so each dispatch re-resolves `context()` against the current Swoole coroutine. Restores the behavior of the pre-migration `getContainer()` form. Co-Authored-By: Claude Opus 4.7 --- app/http.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/http.php b/app/http.php index c95ce77f4a..6dc415f000 100644 --- a/app/http.php +++ b/app/http.php @@ -191,7 +191,7 @@ $http->on(Constant::EVENT_AFTER_RELOAD, function ($server) { Console::success('Reload completed...'); }); -$container->set('bus', fn ($register) => $register->get('bus')->setResolver($swoole->context()->get(...)), ['register']); +$container->set('bus', fn ($register) => $register->get('bus')->setResolver(fn (string $name) => $swoole->context()->get($name)), ['register']); include __DIR__ . '/controllers/general.php';