class Obsctl::Server::ObsSupervisor

Overview

Owns the single OBS WebSocket client and reconnect loop for the daemon.

Defined in:

obsctl/server/obs_supervisor.cr

Constant Summary

DISCONNECT_FALLBACK_TIMEOUT = 100.milliseconds

Constructors

Instance Method Summary

Constructor Detail

def self.new(config : Config::Config, state : StateStore, event_broadcast : Proc(JSON::Any, Nil) | Nil = nil, log_broadcast : Proc(JSON::Any, Nil) | Nil = nil, logger : Runtime::Logger | Nil = nil, diagnostic_log_broadcast : Proc(JSON::Any, Bool) | Nil = nil) #

Creates a supervisor that updates server state and optional event/log broadcasts.


[View source]

Instance Method Detail

def alive? : Bool #

Returns true while the supervisor loop is starting or can still act.


[View source]
def reconnect : Bool #

Drops the active client so the supervisor reconnect loop starts over.


[View source]
def start : Nil #

Starts the reconnecting supervisor loop in a background fiber.


[View source]
def stop : Nil #

Stops reconnect attempts and closes the active OBS client.


[View source]
def stopped_reconnect_attempted? : Bool #

Test-only observability for reconnect attempts rejected by stopped lifecycle state.


[View source]
def test_reconnect_before_publication : Proc(Nil) | Nil #

Test-only synchronization hook invoked after #reconnect captures a live generation and before it re-checks that generation for public reconnect publication. The hook runs without supervisor locks held and may block to coordinate deterministic race specs.


[View source]
def test_reconnect_before_publication=(test_reconnect_before_publication : Proc(Nil) | Nil) #

Test-only synchronization hook invoked after #reconnect captures a live generation and before it re-checks that generation for public reconnect publication. The hook runs without supervisor locks held and may block to coordinate deterministic race specs.


[View source]
def with_client(&block : OBS::Client -> T) : T forall T #

Yields the active OBS client or raises when OBS is unavailable.


[View source]