fix(devices): read devices and device options through to the database #8

Merged
benvin merged 1 commits from benvin/fix-device-cache into main 2026-09-13 14:23:18 +10:00
Member

DeviceManager filled its device and device options dictionaries once at construction and never re-read them, so with replicas sharing one database a token minted on one replica 401s on every replica that was already running, and a token revoked on one replica keeps authenticating on the others until they restart.

  • drop the eager device and device options dictionaries
  • read devices and device options from the database on every query
  • push the device query filters and ordering into SQL
  • open the request database context only for the api key fallback
  • cover creation and revocation across two manager instances on real PostgreSQL
DeviceManager filled its device and device options dictionaries once at construction and never re-read them, so with replicas sharing one database a token minted on one replica 401s on every replica that was already running, and a token revoked on one replica keeps authenticating on the others until they restart. - drop the eager device and device options dictionaries - read devices and device options from the database on every query - push the device query filters and ordering into SQL - open the request database context only for the api key fallback - cover creation and revocation across two manager instances on real PostgreSQL
unkin-agent added 1 commit 2026-09-13 13:09:01 +10:00
fix(devices): read devices and device options through to the database
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
56919b9565
The device cache was filled once at construction, so a token minted by one
replica was unknown to every other replica already running and a token revoked
on one replica stayed valid on the others until they restarted.

- drop the eager device and device options dictionaries
- read devices and device options from the database on every query
- push the device query filters and ordering into SQL
- open the request's database context only for the api key fallback
- cover both directions against real PostgreSQL with two manager instances
benvin merged commit 0c707c7989 into main 2026-09-13 14:23:18 +10:00
benvin deleted branch benvin/fix-device-cache 2026-09-13 14:23:18 +10:00
Sign in to join this conversation.