Skip to content

Commit

Permalink
[Update] server: manual interruption support
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien committed Sep 13, 2024
1 parent f5e333a commit 8628e39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/py/extra/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,11 @@ def run(
host=host, port=port, backlog=backlog, condition=condition, timeout=timeout
)
app = mount(*components)
asyncio.run(AIOSocketServer.Serve(app, options))
try:
asyncio.run(AIOSocketServer.Serve(app, options))
except KeyboardInterrupt:
event("ManualShutdown")
event("EOK")


# EOF
4 changes: 2 additions & 2 deletions src/py/extra/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def error(

def event(
event: str,
value: Any,
value: Any = None,
*,
origin: str | None = None,
at: float | None = None,
Expand All @@ -235,7 +235,7 @@ def event(

def notify(
name: str,
value: Any,
value: Any = None,
*,
origin: str | None = None,
at: float | None = None,
Expand Down

0 comments on commit 8628e39

Please sign in to comment.