6.2 KiB
id, title, status, type, team, supporting_teams, roadmap_item, priority
| id | title | status | type | team | supporting_teams | roadmap_item | priority | |
|---|---|---|---|---|---|---|---|---|
| TASK-271 | Split RCON live ingestion from historical materialization | in-progress | backend | Backend Senior |
|
current-match | high |
TASK-271 - Split RCON live ingestion from historical materialization
Goal
Separate near-real-time AdminLog ingestion for current-match freshness from the slow historical materialization path so /api/current-match/kills and /api/current-match/players can stay fresh without waiting on heavy historical work.
Context
Production evidence shows the current combined worker design is starving the current-match read model:
- production service
hll-vietnam-rcon-historical-worker-1currently runspython -m app.rcon_historical_worker loop - configured interval is
HLL_RCON_HISTORICAL_CAPTURE_INTERVAL_SECONDS=2 - configured AdminLog lookback is
HLL_BACKEND_RCON_ADMIN_LOG_LOOKBACK_MINUTES=10 - real
rcon_historical_capture_runsdurations are around15-30minutes - recent runs overlapped and one failed with PostgreSQL deadlock
- each cycle materializes roughly
838kplayer-stat rows and updates roughly392-394materialized matches /api/current-match/killsand/api/current-match/playersreadrcon_admin_log_events, not live CRCON/RCON per public request
This means the current-match feed problem is not primarily frontend rendering. The source table is not being refreshed frequently enough because live AdminLog ingestion is coupled to heavy historical materialization.
This task must preserve the current product identity and must not change frontend layout, CSS, assets, RCON hosts, ports, passwords, server list, 27001, ranking semantics, Elo/MMR activation, or reintroduce comunidad-hispana-03.
Steps
- Inspect the current historical worker, current-match worker, AdminLog ingestion/storage, materialization path, API read path and Portainer deployment.
- Implement a dedicated lightweight live AdminLog worker that only refreshes
rcon_admin_log_events. - Reduce repeated PostgreSQL schema initialization in the live path by moving obvious DDL/init work out of hot loops and request reads.
- Add no-overlap protection for heavy historical materialization so concurrent heavy runs skip cleanly instead of overlapping.
- Update Portainer deployment so live ingestion and heavy historical materialization run as separate services with safe cadences.
- Add or update focused tests and refresh the current-match freshness documentation with post-deploy validation commands.
Files to Read First
AGENTS.mdai/architecture-index.mdai/repo-context.mdai/orchestrator/backend-senior.mdbackend/app/rcon_historical_worker.pybackend/app/rcon_current_match_worker.pybackend/app/rcon_admin_log_ingestion.pybackend/app/rcon_admin_log_storage.pybackend/app/postgres_rcon_storage.pybackend/app/payloads.pydeploy/portainer/docker-compose.nas.ymldocs/current-match-adminlog-freshness.md
Expected Files to Modify
ai/tasks/in-progress/TASK-271-split-rcon-live-ingestion-from-historical-materialization.mdbackend/app/rcon_current_match_worker.pybackend/app/rcon_admin_log_storage.pybackend/app/postgres_rcon_storage.pybackend/app/rcon_historical_storage.pybackend/app/rcon_historical_worker.pybackend/tests/test_rcon_current_match_worker.pybackend/tests/test_rcon_historical_worker.pybackend/tests/test_current_match_payload.pydeploy/portainer/docker-compose.nas.ymldocs/current-match-adminlog-freshness.md
Constraints
- Do not run
ai-platform run. - Do not commit or push.
- Do not use
git add .. - Do not touch
ai/system-metrics.md. - Do not include
tmp/. - Do not include TASK-204, TASK-242 or unrelated in-progress/done tasks.
- Do not touch weapon assets, map assets or clan assets.
- Do not touch frontend layout or CSS.
- Do not change RCON hosts, ports, passwords,
27001or the configured server list. - Do not reintroduce
comunidad-hispana-03. - Do not reactivate Elo/MMR.
- Do not change ranking semantics or fabricate support rankings.
- Do not change annual tops/player search behavior except where explicitly needed to stop them from blocking live ingestion.
- Keep the change backend/deployment/documentation scoped and reviewable.
Validation
Before completing the task ensure:
python -m compileall backend/appcd backend; python -m unittest tests.test_current_match_payloadcd backend; python -m unittest tests.test_rcon_historical_workercd backend; python -m unittest tests.test_rcon_current_match_workergit diff --name-onlymatches the intended scope- no unrelated dirty files were modified
- documentation reflects the new live worker split and post-deploy checks
Outcome
Implemented scope:
- dedicated live AdminLog worker path kept in
backend/app/rcon_current_match_worker.py - live worker storage initialization moved out of the hot loop body and out of per-target persistence calls
- live worker no longer waits on the shared long-running backend writer lock
- current-match persistence stays idempotent through the existing
rcon_admin_log_eventsdedupe path - historical capture/materialization path gained a single-running historical guard and returns
skippedwithalready-runningwhen a heavy run is still active - Portainer deployment now splits
rcon-live-adminlog-workerfromrcon-historical-worker - heavy historical cadence was set explicitly to
900seconds in the Portainer compose file
Validation completed:
python -m compileall backend/appcd backend; python -m unittest tests.test_current_match_payloadcd backend; python -m unittest tests.test_rcon_historical_workercd backend; python -m unittest tests.test_rcon_current_match_worker
Follow-up intentionally left out of central scope:
TEAM KILLparser correctness remains a separate follow-up task unless handled later with a tiny isolated patch
Change Budget
- Prefer fewer than 5 modified files when feasible, but accept a slightly larger backend/deploy/docs scope if required to complete the split safely.
- Prefer focused edits over broad refactors.
- Split out follow-up correctness issues instead of expanding scope unnecessarily.