Skip to content

Commit

Permalink
Removed not necessary scheduler based messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
lotharthesavior committed May 23, 2024
1 parent fe7755c commit 8447381
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/Services/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ public function handleStart(OpenSwooleServer $server): void
}

event(JackedServerStarted::class, $server->host, $server->port);

$this->startDirectMessageTick($server);
}

public function handleRequest(Request $request, Response $response): void
Expand Down Expand Up @@ -402,25 +400,4 @@ private function getServerConfig(bool $ssl): array
'open_http_protocol' => true,
] : []));
}

private function startDirectMessageTick(OpenSwooleServer $server): void
{
$server->tick(1000, function () use ($server) {
Cache::lock('conveyor-messages', 2)->block(6, function () use ($server) {
foreach (Cache::pull('conveyor-messages', []) as $message) {
$data = DirectMessage::fromArray($message);
ConveyorBroadcast::forceBroadcastToChannel(
data: json_encode([
'action' => BroadcastAction::NAME,
'data' => $data->message,
]),
channel: $data->channel,
server: $server,
channelPersistence: Arr::get($this->wsPersistence, 'channels'),
ackPersistence: Arr::get($this->wsPersistence, 'messages-acknowledgments'),
);
}
});
});
}
}

0 comments on commit 8447381

Please sign in to comment.