From 430c8edc9b3eb8d3bb0af6fb743a5dea2f4c0f9f Mon Sep 17 00:00:00 2001 From: ging-dev Date: Thu, 30 May 2024 18:10:48 +0700 Subject: [PATCH] Revert #195 --- .../Reverb/Console/Commands/StartServer.php | 18 ++++++++---------- src/Servers/Reverb/Http/Server.php | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Servers/Reverb/Console/Commands/StartServer.php b/src/Servers/Reverb/Console/Commands/StartServer.php index 5da26d1e..d4209444 100644 --- a/src/Servers/Reverb/Console/Commands/StartServer.php +++ b/src/Servers/Reverb/Console/Commands/StartServer.php @@ -20,8 +20,6 @@ use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\SignalableCommandInterface; -use function React\Async\async; - #[AsCommand(name: 'reverb:start')] class StartServer extends Command implements SignalableCommandInterface { @@ -92,10 +90,10 @@ protected function ensureHorizontalScalability(LoopInterface $loop): void */ protected function ensureStaleConnectionsAreCleaned(LoopInterface $loop): void { - $loop->addPeriodicTimer(60, async(function () { + $loop->addPeriodicTimer(60, function () { PruneStaleConnections::dispatch(); PingInactiveConnections::dispatch(); - })); + }); } /** @@ -105,7 +103,7 @@ protected function ensureRestartCommandIsRespected(Server $server, LoopInterface { $lastRestart = Cache::get('laravel:reverb:restart'); - $loop->addPeriodicTimer(5, async(function () use ($server, $host, $port, $lastRestart) { + $loop->addPeriodicTimer(5, function () use ($server, $host, $port, $lastRestart) { if ($lastRestart === Cache::get('laravel:reverb:restart')) { return; } @@ -115,7 +113,7 @@ protected function ensureRestartCommandIsRespected(Server $server, LoopInterface $server->stop(); $this->components->info("Stopping server on {$host}:{$port}"); - })); + }); } /** @@ -143,9 +141,9 @@ protected function ensurePulseEventsAreCollected(LoopInterface $loop, int $inter return; } - $loop->addPeriodicTimer($interval, async(function () { + $loop->addPeriodicTimer($interval, function () { $this->laravel->make(\Laravel\Pulse\Pulse::class)->ingest(); - })); + }); } /** @@ -157,9 +155,9 @@ protected function ensureTelescopeEntriesAreCollected(LoopInterface $loop, int $ return; } - $loop->addPeriodicTimer($interval, async(function () { + $loop->addPeriodicTimer($interval, function () { \Laravel\Telescope\Telescope::store($this->laravel->make(\Laravel\Telescope\Contracts\EntriesRepository::class)); - })); + }); } /** diff --git a/src/Servers/Reverb/Http/Server.php b/src/Servers/Reverb/Http/Server.php index bdb44d8a..182a849f 100644 --- a/src/Servers/Reverb/Http/Server.php +++ b/src/Servers/Reverb/Http/Server.php @@ -27,7 +27,7 @@ public function __construct(protected ServerInterface $socket, protected Router $this->loop = $loop ?: Loop::get(); - $this->loop->addPeriodicTimer(30, \React\Async\async(fn () => gc_collect_cycles())); + $this->loop->addPeriodicTimer(30, fn () => gc_collect_cycles()); // Register __invoke handler for this class to receive new connections... $socket->on('connection', $this);