-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect inactive peers and remove them from lobbies (#187)
Inactive peers are peers that haven't had a connection to the signalling server for a while. We see some of these peers that will never reconnect still lingering in lobbies that never get cleaned. See: #181 Before this the TimeoutManager only kept track of which peers were disconnected and removed the ones that didn't reconnect within a certain time. After this change it also tracks peers that somehow aren't getting properly disconnected (for example due to a pod restart) and removes them. After this pull gets merged we need to run this query once to fill the peers table with all peers in current lobbies: ```sql INSERT INTO peers (peer, last_seen, updated_at) SELECT UNNEST(peers) AS peer, NOW() AS last_seen, NOW() AS updated_at FROM lobbies ON CONFLICT (peer) DO UPDATE SET last_seen = NOW(), updated_at = NOW() ``` After this pull we also need to keep track of the performance of `MarkPeerAsReconnected` and `ClaimNextTimedOutPeer`. These functions do a `FROM lobbies WHERE $1 = ANY(peers)` without index. They don't do this very often and with a limited amount of lobbies this shouldn't be an issue. Maintaining an index on `peers` probably costs more CPU at the moment, but this will need to be monitored.
- Loading branch information
1 parent
e0cc548
commit 985ef5c
Showing
9 changed files
with
268 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.