Spaces:
Build error
Build error
File size: 686 Bytes
6fbc8ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | """In-memory store for recent incident reports.
Bounded (maxlen), not persisted across restarts -- exists to give the
causal explainer and GET /history recent context, not as a durable audit
trail. The cap protects against unbounded memory growth from
POST /report_incident, which can be called repeatedly by anything holding
a valid internal key.
Shared by app.api.routes_incidents (writes, via report_incident) and
app.api.routes_history (reads, via GET /history) -- both must import this
same object rather than declaring their own list, or writes and reads
silently operate on two different lists.
"""
from collections import deque
incident_history: deque = deque(maxlen=10_000)
|