add loop to uvicorn
This commit is contained in:
parent
865806ca4b
commit
47c334de7a
1 changed files with 3 additions and 6 deletions
|
|
@ -1,12 +1,7 @@
|
||||||
import asyncio
|
|
||||||
|
|
||||||
import uvloop
|
import uvloop
|
||||||
|
|
||||||
uvloop.install()
|
uvloop.install()
|
||||||
|
|
||||||
import contextlib
|
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
@ -49,6 +44,7 @@ def main(ctx, port: int, host: str, ssl_keyfile: str, ssl_certfile: str, reload:
|
||||||
while True:
|
while True:
|
||||||
config = uvicorn.Config(
|
config = uvicorn.Config(
|
||||||
"lnbits.__main__:app",
|
"lnbits.__main__:app",
|
||||||
|
loop="uvloop",
|
||||||
port=port,
|
port=port,
|
||||||
host=host,
|
host=host,
|
||||||
reload=reload,
|
reload=reload,
|
||||||
|
|
@ -65,9 +61,10 @@ def main(ctx, port: int, host: str, ssl_keyfile: str, ssl_certfile: str, reload:
|
||||||
server_restart.clear()
|
server_restart.clear()
|
||||||
server.should_exit = True
|
server.should_exit = True
|
||||||
server.force_exit = True
|
server.force_exit = True
|
||||||
|
time.sleep(3)
|
||||||
process.terminate()
|
process.terminate()
|
||||||
process.join()
|
process.join()
|
||||||
time.sleep(3)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
server_restart = mp.Event()
|
server_restart = mp.Event()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue