Spaces:
Sleeping
Sleeping
| """ | |
| A singleton message broker for the application. | |
| This ensures that the same asyncio.Queue instance is shared across all parts | |
| of the application, including background tasks and API request handlers. | |
| """ | |
| import asyncio | |
| class SignalBroker: | |
| def __init__(self): | |
| self.queue = asyncio.Queue() | |
| # Create a single, global instance of the broker. | |
| signal_broker = SignalBroker() |