Housekeeping Worker

The Housekeeping Worker performs periodic maintenance tasks that keep the deployment healthy over time: expiring stale caches, pruning temporary data left by indexing, and running consistency checks between the database and the chain.


Tasks

  • Cache expiry — invalidates cached API responses and metadata that have gone stale.
  • Temporary data pruning — removes intermediate records created during backfill and reindex runs.
  • Consistency checks — samples recent blocks and compares stored hashes against the chain node to catch drift early.
  • Orphan cleanup — removes rows left behind by interrupted operations.

Scheduling

Tasks run on a configurable interval (defaults are fine for most deployments). Heavy tasks — like deep consistency scans — are staggered to avoid load spikes on the database during peak traffic.

Operating Notes

  • All tasks are idempotent and safe to re-run.
  • The worker logs every task run with duration and affected row counts; alert on repeated failures rather than single blips.
  • Consistency-check mismatches are rare but serious — they usually indicate a reorg handling bug or node issue. Investigate before dismissing.

See Monitoring for metrics and Updates & Maintenance for routine maintenance practices.