Skip to content

ADR 0003: Durable shared sports request budgets

  • Status: accepted; deployed for the shared fĂștbol/college collector on 11 October 2026
  • Date: 10 October 2026

Decision

Keep provider payload caches and rendered dashboard assets in bounded process memory, but persist API-Sports request reservations in a small dedicated quota ledger. Reserve before every upstream request, including pages, detail lookups and failed attempts. Separate counters by API and UTC day; default ceilings are 90/day and eight/minute, below the observed free-tier allowances.

One process owns a state directory through an exclusive lock. Atomic file replacement preserves counters across restarts. Missing configuration, unreadable/corrupt state or competing ownership fails closed. Provider headers can reduce available credit, never reset it upward. Deliberately deleting the state or using another program/key consumer defeats local accounting and must not be routine cleanup.

Consequences

The collector has a small writable named quota volume, despite the container's read-only root filesystem. That volume is operational state, not media storage or a database. A separate bounded logo-cache volume stores provider images. Releases and rollback preserve it; do not use docker compose down -v during normal deployment. This changes no device transport or Nginx configuration. The existing baseball collector has a separate legacy in-process ceiling; this decision does not claim to retrofit its quota accounting.

For local execution, supply an absolute writable ApiSports__StateDirectory outside Git and a private runtime key. A new empty directory starts local accounting; it does not prove the account has its full daily allowance left. Allow for earlier probes and other key users before activation. Multi-instance collection or account-wide coordination needs a different shared store.