kopia lustrzana https://github.com/Yakifo/amqtt
for 'amqtt' (broker script) was creating a new event loop but not passing it to the broker, so the broker was running in one event loop and all of its coroutines were executing in another, not a supported behavior
rodzic
a43f81a9b1
commit
e738335c7f
|
@ -180,7 +180,7 @@ class Broker:
|
|||
self.config.update(config)
|
||||
self._build_listeners_config(self.config)
|
||||
|
||||
self._loop = loop or asyncio.new_event_loop()
|
||||
self._loop = loop or asyncio.get_running_loop()
|
||||
self._servers: dict[str, Server] = {}
|
||||
self._init_states()
|
||||
self._sessions: dict[str, tuple[Session, BrokerProtocolHandler]] = {}
|
||||
|
|
|
@ -54,11 +54,10 @@ def broker_main(
|
|||
typer.echo(f"❌ Config file error: {exc}", err=True)
|
||||
raise typer.Exit(code=1) from exc
|
||||
|
||||
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
try:
|
||||
broker = Broker(config)
|
||||
broker = Broker(config, loop=loop)
|
||||
except (BrokerError, ParserError, PluginError) as exc:
|
||||
typer.echo(f"❌ Broker failed to start: {exc}", err=True)
|
||||
raise typer.Exit(code=1) from exc
|
||||
|
|
Ładowanie…
Reference in New Issue