Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor & deduplicate web UI boot code #10557

Merged
merged 10 commits into from
May 20, 2023
Prev Previous commit
Next Next commit
Refactor configure_sigint_handler out
  • Loading branch information
akx committed May 19, 2023
commit 8200e0c27bb4b7f00b30f5b96186413b752d1f84
22 changes: 13 additions & 9 deletions webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,22 @@ def validate_tls_options():
startup_timer.record("TLS")


def configure_sigint_handler():
# make the program just exit at ctrl+c without waiting for anything
def sigint_handler(sig, frame):
print(f'Interrupted with signal {sig} in {frame}')
os._exit(0)

if not os.environ.get("COVERAGE_RUN"):
# Don't install the immediate-quit handler when running under coverage,
# as then the coverage report won't be generated.
signal.signal(signal.SIGINT, sigint_handler)


def initialize():
fix_asyncio_event_loop_policy()
validate_tls_options()
configure_sigint_handler()
check_versions()

extensions.list_extensions()
Expand Down Expand Up @@ -237,15 +250,6 @@ def initialize():

startup_timer.record("extra networks")

# make the program just exit at ctrl+c without waiting for anything
def sigint_handler(sig, frame):
print(f'Interrupted with signal {sig} in {frame}')
os._exit(0)

if not os.environ.get("COVERAGE_RUN"):
# Don't install the immediate-quit handler when running under coverage,
# as then the coverage report won't be generated.
signal.signal(signal.SIGINT, sigint_handler)


def setup_middleware(app):
Expand Down