Gateway#3
Merged
Jenish-1235 merged 20 commits intodevfrom Dec 19, 2025
Merged
Conversation
…g for audio/video streams, include comprehensive tests for gateway components.
…or Redis settings, and add Redis service to Docker Compose. Include tests for Redis client functionality.
- Add secondary index (user_sessions:{user_id} SET) for O(1) lookups
- Implement grace period (10-min TTL) on disconnect for session reuse
- Throttle activity updates to 5 minutes (16,500x reduction)
- Add comprehensive integration tests for end-to-end verification
- Ensure no ghost sessions (both keys cleaned up properly)
Performance:
- Activity updates: 100 ops/sec → 0.006 ops/sec
- User sessions lookup: O(n) SCAN → O(k) SET lookup
- Implement SessionCleanupService to periodically clean up stale session IDs from Redis. - Integrate session cleanup into the application lifespan management. - Add distributed locking mechanism to prevent concurrent cleanup operations. - Enhance Redis client with batch operations for efficient key existence checks. - Introduce comprehensive unit and integration tests for the cleanup service and its interactions with Redis. This update improves session management reliability and ensures stale sessions are efficiently removed, enhancing overall application performance.
- Add redis_max_connections setting to configure maximum Redis connections. - Refactor main.py to initialize Redis client with new connection settings. - Update health check endpoints to verify Redis connection status. - Remove unused database and Redis client creation functions. - Introduce idempotent session keys for WebSocket connections to improve session management. - Implement batch operations in Redis client for efficient session handling. - Update tests to reflect changes in session management and Redis interactions. These enhancements improve the application's performance and reliability in managing Redis connections and user sessions.
…ultiple files - Simplified string formatting in config.py, main.py, and various model files for improved readability. - Refactored method signatures in auth.py, keyvault.py, and test files to enhance consistency and clarity. - Cleaned up exception representation in exceptions.py for better debugging output.
…, atomic pipelines, and improved connection tracking; fix test mocks
…eck for audio processor
Upgrade gateway
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 several improvements and updates across the codebase, focusing on upgrading the Python version, simplifying health checks, improving Redis and database connection handling, and enhancing configuration flexibility. The changes also include code cleanup and minor refactoring for better maintainability and clarity.
Environment and Dependency Upgrades:
Dockerfileand GitHub Actions CI workflow for consistency and access to the latest language features and performance improvements. [1] [2] [3] [4]Infrastructure and Service Integration:
redis:7-alpineDocker image, enabling integration tests that require Redis.Configuration and Connection Handling:
Settingsclass to support an explicitREDIS_URLenvironment variable, allowing more flexible Redis connection configuration, especially in containerized environments. Also added aredis_max_connectionssetting. [1] [2]ping()methods of the database and Redis clients, removing the need for separate verification functions. [1] [2] [3]core/__init__.pymodule. [1] [2] [3]Code Cleanup and Minor Refactoring:
AppStateclass to include apod_idattribute for distributed connection management and changed the Redis client cleanup method fromclose()todisconnect(). [1] [2]These changes collectively improve the project's maintainability, deployment flexibility, and reliability, especially in containerized and cloud environments.