forked from mirrors/thatmattlove-hyperglass
fix missing startup actions; closes #242
This commit is contained in:
parent
7c398fdf4f
commit
fedd0b4196
1 changed files with 8 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
"""Gunicorn Config File."""
|
"""Start hyperglass."""
|
||||||
|
|
||||||
# Standard Library
|
# Standard Library
|
||||||
|
import asyncio
|
||||||
import sys
|
import sys
|
||||||
import typing as t
|
import typing as t
|
||||||
import logging
|
import logging
|
||||||
|
|
@ -89,6 +90,11 @@ def unregister_all_plugins() -> None:
|
||||||
def start(*, log_level: t.Union[str, int], workers: int) -> None:
|
def start(*, log_level: t.Union[str, int], workers: int) -> None:
|
||||||
"""Start hyperglass via ASGI server."""
|
"""Start hyperglass via ASGI server."""
|
||||||
|
|
||||||
|
register_all_plugins()
|
||||||
|
|
||||||
|
if not Settings.disable_ui:
|
||||||
|
asyncio.run(build_ui())
|
||||||
|
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
app="hyperglass.api:app",
|
app="hyperglass.api:app",
|
||||||
host=str(Settings.host),
|
host=str(Settings.host),
|
||||||
|
|
@ -173,6 +179,7 @@ def run(workers: int = None):
|
||||||
unregister_all_plugins()
|
unregister_all_plugins()
|
||||||
raise error
|
raise error
|
||||||
except (SystemExit, BaseException):
|
except (SystemExit, BaseException):
|
||||||
|
unregister_all_plugins()
|
||||||
sys.exit(4)
|
sys.exit(4)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue