Fix P1 blockers: configurable port, connection leak, race condition, DB path + WAL
- P1 #551: Add STATUS_PORT env var (default 9191) for configurable HTTP status server port - P1 #552: Fix SQLite connection leak — wrap all sqlite3.connect() with try/finally in lookup_person(), seed_persons_from_db(), log_signal(), log_presence_change() - P1 #553: Fix race condition in update_person_state() — compute certainty snapshot under devices_lock, determine state transition under persons_lock, send alert outside locks to prevent stale snapshot - P2 #559 (included): Add WAL mode + pragmas to init_db() for concurrent write safety - Database path: Align to /opt/sensor/presence.db in both daemon and install.sh - Increase connection timeout from 1s to 10s across all functions - install.sh: Document PRESENCE_STATUS_PORT and PRESENCE_MATRIX_WEBHOOK env vars
This commit is contained in:
+5
-1
@@ -28,7 +28,11 @@ Type=simple
|
||||
ExecStart=/usr/bin/python3 /opt/sensor/sensor.py
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
Environment=PRESENCE_DB_PATH=/opt/sensor/sensor.db
|
||||
Environment=PRESENCE_DB_PATH=/opt/sensor/presence.db
|
||||
# Optional: override default status port (9191)
|
||||
# Environment=PRESENCE_STATUS_PORT=9191
|
||||
# Optional: configure Matrix webhook for alerts
|
||||
# Environment=PRESENCE_MATRIX_WEBHOOK=https://matrix.example.com/hook
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Reference in New Issue
Block a user