maybe sigterm maybe handling
This commit is contained in:
parent
57b4102016
commit
4c5dbaefec
@ -7,12 +7,11 @@ from nacl.signing import VerifyKey
|
|||||||
from nacl.utils import random
|
from nacl.utils import random
|
||||||
|
|
||||||
from v6d0auth import certs
|
from v6d0auth import certs
|
||||||
|
|
||||||
__all__ = ('V6D0AuthAppFactory',)
|
|
||||||
|
|
||||||
from v6d0auth.appfactory import AppFactory
|
from v6d0auth.appfactory import AppFactory
|
||||||
from v6d0auth.cdb import CDB, Role, AbstractRequest
|
from v6d0auth.cdb import CDB, Role, AbstractRequest
|
||||||
|
|
||||||
|
__all__ = ('V6D0AuthAppFactory',)
|
||||||
|
|
||||||
|
|
||||||
class V6D0AuthAppFactory(AppFactory):
|
class V6D0AuthAppFactory(AppFactory):
|
||||||
def __init__(self, cdb: CDB):
|
def __init__(self, cdb: CDB):
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import signal
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
|
||||||
@ -18,6 +19,13 @@ async def start_app(app: web.Application):
|
|||||||
"(Press CTRL+C to quit)".format(", ".join(names))
|
"(Press CTRL+C to quit)".format(", ".join(names))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
loop = asyncio.get_running_loop()
|
||||||
|
|
||||||
|
def sigtermed(*_args):
|
||||||
|
loop.create_task(app.shutdown())
|
||||||
|
|
||||||
|
signal.signal(signal.SIGTERM, sigtermed)
|
||||||
|
|
||||||
|
|
||||||
async def run_app(app: web.Application):
|
async def run_app(app: web.Application):
|
||||||
await start_app(app)
|
await start_app(app)
|
||||||
|
Loading…
Reference in New Issue
Block a user