Skip to content

Commit

Permalink
Update FirehoseServeCommand.php
Browse files Browse the repository at this point in the history
  • Loading branch information
kawax committed Dec 15, 2024
1 parent 7de6b7e commit 251bc0c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Console/FirehoseServeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,9 @@ public function handle(): int

$this->info('Host : '.$host);

$event = null;

while (! $ws->eof() || $this->running) {
$event .= $ws->read();
$event = $ws->read();

// Firehose often receives incorrect data.
$header = rescue(fn () => CBOR::decode($event));
if (blank($header) || ! $header instanceof MapObject) {
if ($this->output->isVerbose()) {
Expand Down Expand Up @@ -109,7 +106,6 @@ public function handle(): int

if (Arr::has($header, ['t']) && is_array($payload)) {
event(new FirehoseMessageReceived($header, $payload, $roots, $blocks, $host, $event));
$event = null;
}
}

Expand Down

0 comments on commit 251bc0c

Please sign in to comment.