mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-26 17:30:46 -04:00
Add sentinel waiting-state tracking, synchronization broadcasts, and restore status handling across server and application interfaces.
37 lines
830 B
PHP
37 lines
830 B
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use App\Models\Server;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Broadcasting\PrivateChannel;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class SentinelSynchronized implements ShouldBroadcast
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public ?int $teamId = null;
|
|
|
|
public string $serverUuid;
|
|
|
|
public function __construct(Server $server)
|
|
{
|
|
$this->teamId = $server->team_id;
|
|
$this->serverUuid = $server->uuid;
|
|
}
|
|
|
|
public function broadcastOn(): array
|
|
{
|
|
if (is_null($this->teamId)) {
|
|
return [];
|
|
}
|
|
|
|
return [
|
|
new PrivateChannel("team.{$this->teamId}"),
|
|
];
|
|
}
|
|
}
|