refactor: replace Trio with asyncio/uvloop

This commit is contained in:
Stefan Stammberger
2021-08-30 19:55:02 +02:00
parent fe79709698
commit d9849d43d2
21 changed files with 332 additions and 317 deletions
+11 -21
View File
@@ -1,28 +1,21 @@
from hypercorn.trio import serve
import trio
import trio_asyncio
from hypercorn.config import Config
import asyncio
from .commands import migrate_databases, transpile_scss, bundle_vendored
import uvloop
from starlette.requests import Request
trio.run(migrate_databases)
from .commands import bundle_vendored, migrate_databases, transpile_scss
from .settings import (DEBUG, LNBITS_COMMIT, LNBITS_DATA_FOLDER,
LNBITS_SITE_TITLE, PORT, SERVICE_FEE, WALLET)
uvloop.install()
asyncio.create_task(migrate_databases())
transpile_scss()
bundle_vendored()
from .app import create_app
app = trio.run(create_app)
from .settings import (
LNBITS_SITE_TITLE,
SERVICE_FEE,
DEBUG,
LNBITS_DATA_FOLDER,
WALLET,
LNBITS_COMMIT,
HOST,
PORT
)
app = create_app()
print(
f"""Starting LNbits with
@@ -35,6 +28,3 @@ print(
"""
)
config = Config()
config.bind = [f"{HOST}:{PORT}"]
trio_asyncio.run(serve, app, config)