# Performance tasks

Source: [performance-and-load-audit.md](performance-and-load-audit.md). One branch per task, each tested (new tests plus the suites it can affect), then merged into `dev`. Findings are numbered as in the audit.

| # | Task | Finding | Status |
|---|---|---|---|
| 1 | Queue the administrator alert listeners, move the inline alerts in `OrderService` to an after-commit job, and batch the per-administrator work | 1, 8 | ✅ |
| 2 | Composite indexes on `orders`, and date filters as ranges instead of `whereDate` | 6 | ✅ |
| 3 | Named queues (`realtime`, `push`, `webhooks`, `media`, `default`) with Redis as the documented default | 4 | ✅ |
| 4 | Live fleet: share one cached snapshot between dashboards, and stop polling in background tabs | 5 | ✅ |
| 5 | Order list: indexed `sort_key`, no count on every page, calmer dashboard refetch | 2 | ✅ |
| 6 | Captain ping: throttle the token's `last_used_at` (decoding the polyline once per route was measured and dropped: 0.4 to 2 ms a ping, saving about 1 ms) | 3 | ✅ |
| 7 | Prune expired API tokens, and cache IP location lookups | 13, 9 | ✅ |
| 8 | GPS history: skip points that add nothing (the prune was already batched, which the audit got wrong and now says so) | 7 | ✅ |
| 9 | Store portal: say that a hidden tab does not poll (it already did not; the audit overstated this and now says so) | 12 | ✅ |
| 10 | Environment settings in the runbook and `.env.example` (phpredis, session driver, scheduler, MariaDB) | 14, 4 | ✅ |

Not in this list, on purpose: search by `LIKE '%term%'` (finding 10) needs a product decision about what people search by, and the routing-call cache (finding 11) is already bounded by a 1-second cap.
