wrolpi/modules
Roland 8d395eaf40
api: run the perpetual loops in one Sanic-managed process
The singleton background loops (file worker, downloads, switches, jobs,
bulk tag, flag checks, update check) now run in a dedicated process that
Sanic's Worker Manager owns: `run_perpetual_process` is registered with
`app.manager.manage()` from `main_process_ready`.  The manager guarantees
a single instance and SIGTERMs it on shutdown.  No server worker runs the
loops, so the owner-pid / heartbeat / watchdog claim scheme is deleted
rather than hardened.

`perpetual_signal` keeps its name and is now a plain registrar.  A new
`per_worker_task` registrar covers loops every server worker must run for
itself: syncing its log level (previously only the owner did, so the other
workers never picked up level changes) and a health check that asks the
manager to restart the perpetual process when it is FAILED (Sanic marks a
dead managed process but does not restart it).

Downloads are started as background tasks instead of Sanic signals; the
perpetual process has no server, so no finalized signal router.  The
update check and the upgrade-check endpoint run git in a thread via
`refresh_update_status`.  /api/status lists the perpetual process next
to the servers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 15:35:20 -06:00
..
archive files: SQL FileGroup compare, stem column, drop unused discovery path (#713) 2026-09-18 08:57:56 -06:00
docs files: SQL FileGroup compare, stem column, drop unused discovery path (#713) 2026-09-18 08:57:56 -06:00
flasher Flasher: chip-mismatch guard, WROLPi firmware table, colorblind chip colors 2026-07-02 17:26:37 -06:00
inventory Strip whitespace from inventory item string values on save 2026-07-30 17:34:46 -06:00
map Map previews that never drew, and a Docker map with no world under it (#658) 2026-08-11 20:37:23 -06:00
videos api: run the perpetual loops in one Sanic-managed process 2026-09-22 15:35:20 -06:00
zim files: SQL FileGroup compare, stem column, drop unused discovery path (#713) 2026-09-18 08:57:56 -06:00
__init__.py Move One-Time Pad encryption to the browser (#479) 2026-06-13 13:52:34 -06:00