This commit is contained in:
14
main.py
14
main.py
@@ -1,20 +1,15 @@
|
||||
import os
|
||||
import asyncio
|
||||
from importlib import import_module
|
||||
from os.path import exists
|
||||
|
||||
from ariadne import load_schema_from_path, make_executable_schema
|
||||
from ariadne.asgi import GraphQL
|
||||
from strawberry.asgi import GraphQL
|
||||
from starlette.applications import Starlette
|
||||
|
||||
from services.schema import resolvers
|
||||
from services.rediscache import redis
|
||||
from services.keeper import notification_service
|
||||
from resolvers.listener import start as listener_start, stop as listener_stop
|
||||
from resolvers.schema import schema
|
||||
from settings import DEV_SERVER_PID_FILE_NAME, SENTRY_DSN, MODE
|
||||
|
||||
import_module("resolvers")
|
||||
schema = make_executable_schema(load_schema_from_path("notifier.graphql"), resolvers) # type: ignore
|
||||
|
||||
|
||||
async def start_up():
|
||||
if MODE == "dev":
|
||||
@@ -26,7 +21,7 @@ async def start_up():
|
||||
f.write(str(os.getpid()))
|
||||
else:
|
||||
await redis.connect()
|
||||
notification_service_task = asyncio.create_task(notification_service.worker())
|
||||
notification_service_task = asyncio.create_task(listener_start())
|
||||
print(f"[main] {notification_service_task}")
|
||||
|
||||
try:
|
||||
@@ -39,6 +34,7 @@ async def start_up():
|
||||
|
||||
|
||||
async def shutdown():
|
||||
listener_stop()
|
||||
await redis.disconnect()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user