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
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:
commit
b6d5aabf22
1 changed files with 7 additions and 3 deletions
|
@ -458,11 +458,15 @@ class StreamManager:
|
||||||
|
|
||||||
|
|
||||||
# Global shared instance for application use
|
# Global shared instance for application use
|
||||||
# Will be initialized with config value in app.py
|
# Default initialization, will be updated with config value in app.py
|
||||||
shared_stream_manager = None
|
shared_stream_manager = StreamManager(max_streams=20)
|
||||||
|
|
||||||
def initialize_stream_manager(max_streams: int = 10):
|
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
|
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)
|
shared_stream_manager = StreamManager(max_streams=max_streams)
|
||||||
return shared_stream_manager
|
return shared_stream_manager
|
Loading…
Add table
Add a link
Reference in a new issue