Skip to content

Commit 0a171b1

Browse files
authored
fix: enable connection revalidation to scale to more connections than can fit in memory at once (#491)
Problem ======= Monday's revalidate connections cron is failing every time due to it exceeding memory limits. This is because the full list of connections is too large to fit in memory. Solution ======= Refactor the two places where the AuthDO lists all connections (`_authRevalidateConnections` and `_authInvalidateAll`), to instead incrementally load the connections. For `_authRevalidateConnections` we need to group the connections by roomID, since we revalidate connections a room at a time by fetching the room's current connections. To do this incrementally without having to iterate the entire list of connections incrementally for each room necessitates creating a new index by room id over the connections. To handle the creation of this index for existings AuthDO's, an AuthDO Storage Schema Version is introduced and stored in the AuthDO's storage at key `auth_do_storage_schema_version`. The AuthDO ensures the storage schema version is upgraded to the current version before processing any fetch. Fixes #487
1 parent 8d2e5b8 commit 0a171b1

File tree

2 files changed

+491
-313
lines changed

2 files changed

+491
-313
lines changed

0 commit comments

Comments
 (0)