Apply suggestions from code review of branch pass-portal-to-stop
This commit is contained in:
parent
177cb2eef7
commit
cd6eaf7be7
1 changed files with 2 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Optional, Callable
|
from typing import Optional, Callable
|
||||||
|
from functools import wraps
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
|
||||||
import labthings_fastapi as lt
|
import labthings_fastapi as lt
|
||||||
|
|
@ -30,6 +31,7 @@ def set_shutdown_function(shutdown_function: Callable[[], None]):
|
||||||
|
|
||||||
original_handler = Server.handle_exit
|
original_handler = Server.handle_exit
|
||||||
|
|
||||||
|
@wraps(Server.handle_exit)
|
||||||
def handle_exit(*args, **kwargs):
|
def handle_exit(*args, **kwargs):
|
||||||
shutdown_function()
|
shutdown_function()
|
||||||
original_handler(*args, **kwargs)
|
original_handler(*args, **kwargs)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue