towerops/lib/towerops_web
Graham McIntire 933bfafeb0 Fix DB pool exhaustion and settings page crashes (#88)
## Summary
- **DB pool exhaustion**: `device_has_effective_agent?` was doing 2 DB queries per call (3-table join + global settings lookup), called 2-3x per worker cycle across hundreds of devices (~6000 unnecessary queries/minute). Added an ETS-backed `AgentCache` with 120s TTL and removed redundant calls within the same worker cycle.
- **Settings page crash**: `KeyError: key :user_agent not found` on BrowserSession — field doesn't exist, replaced with `device_type`.
- **Login history IP truncation**: Changed from side-by-side grid to stacked table layout so IP addresses aren't clipped.

## Test plan
- [x] 8 new tests for AgentCache (cache hit, miss, invalidation, global default)
- [x] Full test suite passes (8651 tests, 0 failures, verified across multiple runs)
- [x] `mix format` and pre-commit hooks pass

Reviewed-on: graham/towerops-web#88
2026-03-19 15:16:34 -05:00
..
channels add ssl/tls certificate expiration check type (#64) 2026-03-17 16:14:22 -05:00
components hide rf links from sidebar navigation (#51) 2026-03-16 17:54:57 -05:00
controllers add query_helpers tests and fix all credo issues (#56) 2026-03-17 10:43:57 -05:00
graphql add query_helpers tests and fix all credo issues (#56) 2026-03-17 10:43:57 -05:00
helpers feat: add status emoji to page titles 2026-03-06 14:45:02 -06:00
live Fix DB pool exhaustion and settings page crashes (#88) 2026-03-19 15:16:34 -05:00
plugs add mobile token auth to GraphQL endpoint (#48) 2026-03-16 15:23:07 -05:00
changelog_parser.ex fix: resolve 500 errors on /activity and /changelog 2026-02-13 19:49:12 -06:00
endpoint.ex fix/suppress-health-check-logs (#47) 2026-03-16 15:22:12 -05:00
gettext.ex init 2025-12-21 11:10:43 -06:00
gettext_helpers.ex feat: migrate email templates to gettext (Phase 2 - Emails) 2026-02-02 09:48:30 -06:00
graphql_socket.ex add mobile token auth to GraphQL endpoint (#48) 2026-03-16 15:23:07 -05:00
permissions.ex i18n: add Spanish locale with full translations, language selector, and locale hook 2026-02-14 17:44:01 -06:00
plug_exceptions.ex handle exceptions gracefully on api endpoints 2026-02-04 12:18:14 -06:00
remote_ip.ex perf: disable Req retry for faster error tests 2026-03-10 16:19:31 -05:00
router.ex add service checks REST API, GraphQL API, and ping executor (#52) 2026-03-16 18:40:18 -05:00
scoped_resource.ex perf: disable Req retry for faster error tests 2026-03-10 16:19:31 -05:00
telemetry.ex fix: add Oban config to dev.exs and replace Exq telemetry with Oban 2026-01-24 16:39:45 -06:00
telemetry_filter.ex fix: suppress health check logs and downgrade CI artifacts to v3 2026-03-05 15:54:47 -06:00
user_auth.ex feat: add alert count badge to notification bell 2026-03-12 14:06:18 -05:00