FAILED/OCR FAIL rows never disappear on their own, so counting all of them
made the alarm fire every 5 minutes forever. Only stuck entries and
failures from the last 24 h trigger it now; older ones stay in the DB for
tools/gundi_requeue.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Upload request path uses its own S3 client with short timeouts (5s/30s,
2 attempts) and no longer holds a DB row lock during the S3 call; S3/DB
failures answer 503 + Retry-After instead of 500 after minutes of waiting.
- Transient S3/DB errors in ingest/OCR no longer count against max_attempts
(previously ~15 min of outage turned images into FAILED); the sweep retries.
- The sweep no longer queues the same id twice (no pile-up during long outages).
- Backlog check logs [GUNDI][ALARM] for stuck/failed entries.
- tools/gundi_requeue.py resets FAILED/FAIL entries; unit tests for all of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ICU sends "icu_cameratrap_rep" instead of the documented Gundi/EarthRanger
type "cameratrap_rep". Events of the unknown type were stored as IGNORED, so
the following attachment upload got 404 and no image was ingested. Treat both
names as image events.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ICU now pushes camera events via a Gundi-v2-compatible API instead of
dropping file triplets into S3. The new gundi-receiver service accepts
them directly, so images are in the system within seconds instead of
waiting out the 90s age gate + poll interval. OCR of the burnt-in camera
timestamp stays mandatory (ICU only sends server times; OCR detects
drifting camera clocks) but now runs asynchronously after ingest.
The push path writes a normalized model that separates what the legacy
metadata table conflates: camera_status (status time series), image
(image properties) and detection (classifications), plus the
image_with_status view as the portal's migration target. A repeatable,
batched migration splits existing metadata/category rows into it.
The legacy poller is unchanged and keeps writing metadata/category until
the portal is switched over.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>