feat: add empty room expiry time to configuration and server logic#323
Merged
feat: add empty room expiry time to configuration and server logic#323
Conversation
Collaborator
Author
|
Note: Network Variables are deleted when their parent Room is removed after the 24-hour empty room expiry. Or more detailed:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds configurable delayed removal of empty rooms to the server, preventing immediate deletion when the last client disconnects. The changes update both the device ID mapping expiry time and introduce a new empty room expiry time, both set to 24 hours (previously 5 minutes and immediate respectively).
Changes:
- Added
empty_room_expiry_timeconfiguration parameter (24 hours) to control how long empty rooms persist before removal - Updated
device_id_expiry_timefrom 5 minutes to 24 hours - Implemented delayed room cleanup logic that tracks when rooms become empty and removes them only after the expiry period
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| STYLY-NetSync-Server/src/styly_netsync/config.py | Added empty_room_expiry_time field to ServerConfig dataclass and validation logic |
| STYLY-NetSync-Server/src/styly_netsync/default.toml | Updated device_id_expiry_time to 86400s and added empty_room_expiry_time configuration with documentation |
| STYLY-NetSync-Server/src/styly_netsync/server.py | Added room_empty_since tracking dictionary and implemented delayed room removal logic in _cleanup_clients |
| STYLY-NetSync-Server/tests/test_config.py | Updated tests to verify new default values for both timing parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add comprehensive tests for the delayed room removal feature: - Empty rooms are tracked when all clients disconnect - Empty rooms are NOT removed before expiry time - Empty rooms ARE removed after expiry time elapsed - Room tracking is cleared when a client rejoins - Multiple rooms are tracked independently - EMPTY_ROOM_EXPIRY_TIME is configurable from config Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces configurable delayed removal of empty rooms in the server, allowing rooms without clients to persist for a set period before being deleted. It adds a new configuration option, updates the relevant logic for room cleanup, and ensures the configuration and tests reflect these changes.
Empty Room Expiry Feature:
empty_room_expiry_timeconfiguration option toServerConfig, the default config file (default.toml), and validation logic, allowing control over how long empty rooms are kept before removal. [1] [2] [3] [4]empty_room_expiry_timevalue and added aroom_empty_sincedictionary to track when rooms become empty. [1] [2]Room Cleanup Logic:
_cleanup_clientsmethod to delay removal of empty rooms until they have been empty for at leastempty_room_expiry_time, including logging when rooms become empty or are repopulated.Testing and Defaults:
empty_room_expiry_timeand its presence in custom configurations. [1] [2]Close #240