refactor: replace Trio with asyncio/uvloop
This commit is contained in:
+11
-21
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user