Skip to content

Commit 8628e39

Browse files
committed
[Update] server: manual interruption support
1 parent f5e333a commit 8628e39

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/py/extra/server.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,11 @@ def run(
362362
host=host, port=port, backlog=backlog, condition=condition, timeout=timeout
363363
)
364364
app = mount(*components)
365-
asyncio.run(AIOSocketServer.Serve(app, options))
365+
try:
366+
asyncio.run(AIOSocketServer.Serve(app, options))
367+
except KeyboardInterrupt:
368+
event("ManualShutdown")
369+
event("EOK")
366370

367371

368372
# EOF

src/py/extra/utils/logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def error(
213213

214214
def event(
215215
event: str,
216-
value: Any,
216+
value: Any = None,
217217
*,
218218
origin: str | None = None,
219219
at: float | None = None,
@@ -235,7 +235,7 @@ def event(
235235

236236
def notify(
237237
name: str,
238-
value: Any,
238+
value: Any = None,
239239
*,
240240
origin: str | None = None,
241241
at: float | None = None,

0 commit comments

Comments
 (0)