Skip to content

Commit bc12fd7

Browse files
committed
more Python<3.9 compat
1 parent 0923a89 commit bc12fd7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/idom/server/fastapi.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ async def _activate_dispatcher(self) -> None:
201201

202202
async def _deactivate_dispatcher(self) -> None: # pragma: no cover
203203
# for some reason this isn't getting run during testing
204-
self._dispatch_daemon_future.cancel(f"{self} is shutting down")
204+
logger.debug("Stopping dispatcher - server is shutting down")
205+
self._dispatch_daemon_future.cancel()
205206
await asyncio.wait([self._dispatch_daemon_future])
206207

207208
async def _run_dispatcher(

src/idom/server/sanic.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import json
3+
import logging
34
from threading import Event
45
from typing import Any, Dict, Optional, Tuple, Union
56

@@ -20,6 +21,9 @@
2021
from .base import AbstractRenderServer
2122

2223

24+
logger = logging.getLogger(__name__)
25+
26+
2327
class Config(TypedDict, total=False):
2428
"""Config for :class:`SanicRenderServer`"""
2529

@@ -205,7 +209,8 @@ async def _activate_dispatcher(
205209
async def _deactivate_dispatcher(
206210
self, app: Sanic, loop: asyncio.AbstractEventLoop
207211
) -> None:
208-
self._dispatch_daemon_future.cancel(f"{self} is shutting down")
212+
logger.debug("Stopping dispatcher - server is shutting down")
213+
self._dispatch_daemon_future.cancel()
209214
await asyncio.wait([self._dispatch_daemon_future])
210215

211216
async def _run_dispatcher(

0 commit comments

Comments
 (0)