Merge pull request 'fix: initialization None error' (#13) from dev into main
All checks were successful
Build Worker Base and Application Images / check-base-changes (push) Successful in 8s
Build Worker Base and Application Images / build-base (push) Has been skipped
Build Worker Base and Application Images / build-docker (push) Successful in 2m48s
Build Worker Base and Application Images / deploy-stack (push) Successful in 10s

Reviewed-on: #13
This commit is contained in:
Chawanwit Pornnatwuttigul 2025-09-24 20:21:40 +00:00
commit b6d5aabf22

View file

@ -458,11 +458,15 @@ class StreamManager:
# Global shared instance for application use
# Will be initialized with config value in app.py
shared_stream_manager = None
# Default initialization, will be updated with config value in app.py
shared_stream_manager = StreamManager(max_streams=20)
def initialize_stream_manager(max_streams: int = 10):
"""Initialize the global stream manager with config value."""
"""Re-initialize the global stream manager with config value."""
global shared_stream_manager
# Release old manager if exists
if shared_stream_manager:
# Stop all existing streams gracefully
shared_stream_manager.cleanup()
shared_stream_manager = StreamManager(max_streams=max_streams)
return shared_stream_manager