You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
0 commit comments