feat: implement rolling half-hour report windows anchored to service startup time

This commit is contained in:
2026-05-12 16:17:08 +08:00
parent 4e69eca7cb
commit 454b716f89
6 changed files with 112 additions and 65 deletions

View File

@@ -26,6 +26,7 @@ def build_app(config_path: str | Path | None = None) -> dict:
project_root = resolve_project_root(resolved_config_path)
event_sink_path = resolve_project_path(project_root, config.event_sink.path)
gallery_dir = resolve_project_path(project_root, config.staff.gallery_dir)
startup_time = datetime.now().astimezone()
return {
"config": config,
@@ -51,6 +52,7 @@ def build_app(config_path: str | Path | None = None) -> dict:
normal_count_threshold=config.thresholds.normal_count_threshold,
pause_timeout_seconds=config.thresholds.pause_timeout_seconds,
alert_cooldown_seconds=config.thresholds.alert_cooldown_seconds,
report_window_start=startup_time,
),
"notifier": lambda path, event: dispatch_json_event(
path,