get_agents_view DB request is not usable if you keep many results
The current DB request is
SELECT * from RESULTS t1
FULL OUTER JOIN results t2
ON t1.agent_id = t2.agent_id
AND t1.submitted_at < t2.submitted_at
WHERE t2.agent_id IS NULL;
I was keeping 240 results for 1 539 tasks and the request took so long I got a 502 error due to a WORKER TIMEOUT
.
Suggestion: adding an agents
table with a last_seen
column, updated each time it posts results.