feat: update max_streams
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Build Worker Base and Application Images / deploy-stack (push) Blocked by required conditions
				
			
		
			
				
	
				Build Worker Base and Application Images / check-base-changes (push) Successful in 7s
				
			
		
			
				
	
				Build Worker Base and Application Images / build-base (push) Has been skipped
				
			
		
			
				
	
				Build Worker Base and Application Images / build-docker (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Build Worker Base and Application Images / deploy-stack (push) Blocked by required conditions
				
			Build Worker Base and Application Images / check-base-changes (push) Successful in 7s
				
			Build Worker Base and Application Images / build-base (push) Has been skipped
				
			Build Worker Base and Application Images / build-docker (push) Has been cancelled
				
			This commit is contained in:
		
							parent
							
								
									b8de5e191e
								
							
						
					
					
						commit
						f467cb005d
					
				
					 4 changed files with 18 additions and 5 deletions
				
			
		
							
								
								
									
										7
									
								
								app.py
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								app.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -76,7 +76,7 @@ else:
 | 
			
		|||
        "poll_interval_ms": 100,
 | 
			
		||||
        "reconnect_interval_sec": 5,
 | 
			
		||||
        "target_fps": 10,
 | 
			
		||||
        "max_streams": 5,
 | 
			
		||||
        "max_streams": 20,
 | 
			
		||||
        "max_retries": 3
 | 
			
		||||
    }
 | 
			
		||||
    logger.warning(f"Configuration file {config_path} not found, using defaults")
 | 
			
		||||
| 
						 | 
				
			
			@ -85,6 +85,11 @@ else:
 | 
			
		|||
os.makedirs("models", exist_ok=True)
 | 
			
		||||
logger.info("Ensured models directory exists")
 | 
			
		||||
 | 
			
		||||
# Initialize stream manager with config value
 | 
			
		||||
from core.streaming import initialize_stream_manager
 | 
			
		||||
initialize_stream_manager(max_streams=config.get('max_streams', 10))
 | 
			
		||||
logger.info(f"Initialized stream manager with max_streams={config.get('max_streams', 10)}")
 | 
			
		||||
 | 
			
		||||
# Store cached frames for REST API access (temporary storage)
 | 
			
		||||
latest_frames = {}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
{
 | 
			
		||||
  "poll_interval_ms": 100,
 | 
			
		||||
  "max_streams": 5,
 | 
			
		||||
  "max_streams": 20,
 | 
			
		||||
  "target_fps": 2,
 | 
			
		||||
  "reconnect_interval_sec": 5,
 | 
			
		||||
  "max_retries": -1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ Provides modular frame readers, buffers, and stream management.
 | 
			
		|||
"""
 | 
			
		||||
from .readers import RTSPReader, HTTPSnapshotReader
 | 
			
		||||
from .buffers import FrameBuffer, CacheBuffer, shared_frame_buffer, shared_cache_buffer
 | 
			
		||||
from .manager import StreamManager, StreamConfig, SubscriptionInfo, shared_stream_manager
 | 
			
		||||
from .manager import StreamManager, StreamConfig, SubscriptionInfo, shared_stream_manager, initialize_stream_manager
 | 
			
		||||
 | 
			
		||||
__all__ = [
 | 
			
		||||
    # Readers
 | 
			
		||||
| 
						 | 
				
			
			@ -21,5 +21,6 @@ __all__ = [
 | 
			
		|||
    'StreamManager',
 | 
			
		||||
    'StreamConfig',
 | 
			
		||||
    'SubscriptionInfo',
 | 
			
		||||
    'shared_stream_manager'
 | 
			
		||||
    'shared_stream_manager',
 | 
			
		||||
    'initialize_stream_manager'
 | 
			
		||||
]
 | 
			
		||||
| 
						 | 
				
			
			@ -458,4 +458,11 @@ class StreamManager:
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
# Global shared instance for application use
 | 
			
		||||
shared_stream_manager = StreamManager(max_streams=10)
 | 
			
		||||
# Will be initialized with config value in app.py
 | 
			
		||||
shared_stream_manager = None
 | 
			
		||||
 | 
			
		||||
def initialize_stream_manager(max_streams: int = 10):
 | 
			
		||||
    """Initialize the global stream manager with config value."""
 | 
			
		||||
    global shared_stream_manager
 | 
			
		||||
    shared_stream_manager = StreamManager(max_streams=max_streams)
 | 
			
		||||
    return shared_stream_manager
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue