Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'laravel:main' into main
Browse files Browse the repository at this point in the history
jakubforman authored Jun 1, 2024
2 parents a79fe07 + 363d739 commit 1bd030a
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@
"laravel/prompts": "^0.1.15",
"pusher/pusher-php-server": "^7.2",
"ratchet/rfc6455": "^0.3.1",
"react/async": "^4.2",
"react/promise-timer": "^1.10",
"react/socket": "^1.14",
"symfony/console": "^6.0|^7.0",
@@ -40,6 +39,7 @@
"pestphp/pest": "^2.0",
"phpstan/phpstan": "^1.10",
"ratchet/pawl": "^0.4.1",
"react/async": "^4.2",
"react/http": "^1.9"
},
"autoload": {
18 changes: 8 additions & 10 deletions src/Servers/Reverb/Console/Commands/StartServer.php
Original file line number Diff line number Diff line change
@@ -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));
}));
});
}

/**
2 changes: 1 addition & 1 deletion src/Servers/Reverb/Http/Server.php
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 1bd030a

Please sign in to comment.