cremalink.local_server_app.jobs module
This module defines and manages the background jobs for the local server. These jobs run periodically in asyncio tasks to handle keep-alive, status monitoring, and re-keying operations.
- class cremalink.local_server_app.jobs.JobManager[source]
Bases:
objectA simple manager for starting and stopping asyncio background tasks.
- async cremalink.local_server_app.jobs.monitor_job(st: LocalServerState, settings: ServerSettings, stop_event: Event)[source]
Periodically queues a request to fetch the device’s monitoring status.
- async cremalink.local_server_app.jobs.nudger_job(st: LocalServerState, adapter: DeviceAdapter, settings: ServerSettings, stop_event: Event)[source]
Notifies a live session about pending commands (
PUT local_reg).notify: 1makes the machine pollcommands.jsonpromptly, which is what drains the outgoing queue. While the session is down, registration retries are throttled to the register-timeout cadence —POSTis what actually opens a session (key exchange),PUTalone cannot re-key a live or half-dead one (lodzen/cremalink#4).Cadence follows the app (protocol.md §15,
AylaLanModule): onelocal_regPUT per keepalive tick withnotifyreflecting queue depth — not one PUT per nudger tick. The machine pollscommands.jsonon its own ~1.3 s loop once notified, so faster PUTs cannot drain the queue any quicker (live-observed ~1 PUT/s while pending vs. the app’s ~1 PUT/10 s). A fresh PUT still goes out immediately on an enqueue edge (enqueue_seqmoved — appends between standby ticks count, queue-empty sightings are not needed) so user writes keep ~1-tick latency.
- async cremalink.local_server_app.jobs.session_job(state: LocalServerState, adapter: DeviceAdapter, settings: ServerSettings, stop_event: Event)[source]
Maintains the LAN session (lodzen/cremalink#4).
Live session → keep-alive
PUT local_reg(notify: 1), then verify the machine still pollscommands.json; a silent machine marks the session dead and the next tick re-registers.Dead session →
POST local_regstarts a new session and always triggers a key exchange; keys are only replaced insideLocalServerState.init_crypto(), never wiped beforehand — a preemptive wipe plus a no-rekeyPUTis what produced the hollow sessions this job replaces.