Labels: bug, performance, admin
Linked Sentry: SENSORSAFRICA-API-13Z — https://code-for-africa.sentry.io/issues/7569887953/
Environment: production
/admin/sensors/sensorlocation/ triggers a per-row N+1 query pattern. A separate COUNT(*) FROM sensors_sensordatavalue plus a separate node lookup for each row in the changelist. With default list_per_page (~100), this fires 100+ sequential queries per page load, exceeding Gunicorn's worker timeout, which triggers a SIGABRT and SystemExit: 1.
Root cause
SensorLocationAdmin (or a related inline) lacks select_related/prefetch_related/annotate in get_queryset(). Likely a list_display callable or __str__ touching sensordata_set.count() per row.
Labels: bug, performance, admin
Linked Sentry: SENSORSAFRICA-API-13Z — https://code-for-africa.sentry.io/issues/7569887953/
Environment: production
/admin/sensors/sensorlocation/triggers a per-row N+1 query pattern. A separateCOUNT(*) FROM sensors_sensordatavalueplus a separate node lookup for each row in the changelist. With defaultlist_per_page(~100), this fires 100+ sequential queries per page load, exceeding Gunicorn's worker timeout, which triggers a SIGABRT andSystemExit: 1.Root cause
SensorLocationAdmin(or a related inline) lacksselect_related/prefetch_related/annotateinget_queryset(). Likely alist_displaycallable or__str__touchingsensordata_set.count()per row.