Skip to content

Commit 2eb445e

Browse files
committed
fix missing server event
only need the post start hook if running as daemon
1 parent 2620609 commit 2eb445e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

idom/server/sanic.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,14 @@ def _setup_application(self, app: Sanic, config: Config) -> None:
6464
self._setup_blueprint_routes(bp, config)
6565
app.blueprint(bp)
6666

67-
async def server_did_start(app: Sanic, loop: asyncio.AbstractEventLoop) -> None:
68-
self._daemon_server_did_start.set()
67+
if hasattr(self, "_daemon_server_did_start"):
6968

70-
app.register_listener(server_did_start, "after_server_start")
69+
async def server_did_start(
70+
app: Sanic, loop: asyncio.AbstractEventLoop
71+
) -> None:
72+
self._daemon_server_did_start.set()
73+
74+
app.register_listener(server_did_start, "after_server_start")
7175

7276
def _setup_blueprint_routes(self, blueprint: Blueprint, config: Config) -> None:
7377
"""Add routes to the application blueprint"""

0 commit comments

Comments
 (0)