chore(release): 0.7.0-dev.1 #16
@@ -8,11 +8,15 @@ import threading
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING, Any, Final
|
from typing import TYPE_CHECKING, Any, Final
|
||||||
|
|
||||||
|
from judas_protocol.types import TelemetryAction
|
||||||
import yaml
|
import yaml
|
||||||
from judas_protocol import Category, ControlAction, Message
|
from judas_protocol import Category, ControlAction, Message
|
||||||
|
|
||||||
from judas_server.backend.client import Client, ClientStatus
|
from judas_server.backend.client import Client, ClientStatus
|
||||||
from judas_server.backend.handler.hello_handler import HelloHandler
|
from judas_server.backend.handler.hello_handler import HelloHandler
|
||||||
|
from judas_server.backend.handler.telemetry.initial_handler import (
|
||||||
|
InitialTelemetryHandler,
|
||||||
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
@@ -67,11 +71,16 @@ class BackendServer:
|
|||||||
"""Initialize message handlers."""
|
"""Initialize message handlers."""
|
||||||
|
|
||||||
hello_handler = HelloHandler(self)
|
hello_handler = HelloHandler(self)
|
||||||
|
initial_telemetry_handler = InitialTelemetryHandler(self)
|
||||||
|
|
||||||
self.message_handlers[(Category.CONTROL, ControlAction.HELLO)] = (
|
self.message_handlers[(Category.CONTROL, ControlAction.HELLO)] = (
|
||||||
hello_handler.handle
|
hello_handler.handle
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.message_handlers[
|
||||||
|
(Category.TELEMETRY, TelemetryAction.INITIAL)
|
||||||
|
] = initial_telemetry_handler.handle
|
||||||
|
|
||||||
def _load_known_clients(self) -> dict[str, dict[str, str | float]]:
|
def _load_known_clients(self) -> dict[str, dict[str, str | float]]:
|
||||||
"""Load the list of known clients from a YAML file and validate."""
|
"""Load the list of known clients from a YAML file and validate."""
|
||||||
known_clients: dict[str, dict[str, str | float]] = {}
|
known_clients: dict[str, dict[str, str | float]] = {}
|
||||||
@@ -108,6 +117,9 @@ class BackendServer:
|
|||||||
client.last_seen = float(
|
client.last_seen = float(
|
||||||
known_clients[client_id].get("last_seen", 0.0)
|
known_clients[client_id].get("last_seen", 0.0)
|
||||||
)
|
)
|
||||||
|
client.initial_telemetry = known_clients[client_id].get( # type: ignore
|
||||||
|
"initial_telemetry", None
|
||||||
|
)
|
||||||
self.clients[client_id] = client
|
self.clients[client_id] = client
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
@@ -399,4 +411,5 @@ class BackendServer:
|
|||||||
"addr": client.addr,
|
"addr": client.addr,
|
||||||
"last_seen": client.last_seen,
|
"last_seen": client.last_seen,
|
||||||
"status": client.status,
|
"status": client.status,
|
||||||
|
"initial_telemetry": client.initial_telemetry,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user