g.nursery -> current_app.nursery
This commit is contained in:
parent
d5f5c9473f
commit
2b21a4f479
3 changed files with 6 additions and 9 deletions
|
|
@ -114,10 +114,6 @@ def register_filters(app: QuartTrio):
|
||||||
def register_request_hooks(app: QuartTrio):
|
def register_request_hooks(app: QuartTrio):
|
||||||
"""Open the core db for each request so everything happens in a big transaction"""
|
"""Open the core db for each request so everything happens in a big transaction"""
|
||||||
|
|
||||||
@app.before_request
|
|
||||||
async def before_request():
|
|
||||||
g.nursery = app.nursery
|
|
||||||
|
|
||||||
@app.after_request
|
@app.after_request
|
||||||
async def set_secure_headers(response):
|
async def set_secure_headers(response):
|
||||||
secure_headers.quart(response)
|
secure_headers.quart(response)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import json
|
||||||
import lnurl # type: ignore
|
import lnurl # type: ignore
|
||||||
import httpx
|
import httpx
|
||||||
from urllib.parse import urlparse, urlunparse, urlencode, parse_qs, ParseResult
|
from urllib.parse import urlparse, urlunparse, urlencode, parse_qs, ParseResult
|
||||||
from quart import g, jsonify, make_response, url_for
|
from quart import g, current_app, jsonify, make_response, url_for
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from binascii import unhexlify
|
from binascii import unhexlify
|
||||||
from typing import Dict, Union
|
from typing import Dict, Union
|
||||||
|
|
@ -310,8 +310,8 @@ async def api_payments_sse():
|
||||||
await send_event.send(("keepalive", ""))
|
await send_event.send(("keepalive", ""))
|
||||||
await trio.sleep(25)
|
await trio.sleep(25)
|
||||||
|
|
||||||
g.nursery.start_soon(payment_received)
|
current_app.nursery.start_soon(payment_received)
|
||||||
g.nursery.start_soon(repeat_keepalive)
|
current_app.nursery.start_soon(repeat_keepalive)
|
||||||
|
|
||||||
async def send_events():
|
async def send_events():
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ from os import path
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from quart import (
|
from quart import (
|
||||||
g,
|
g,
|
||||||
|
current_app,
|
||||||
abort,
|
abort,
|
||||||
jsonify,
|
jsonify,
|
||||||
request,
|
request,
|
||||||
|
|
@ -154,7 +155,7 @@ async def lnurl_full_withdraw_callback():
|
||||||
async def pay():
|
async def pay():
|
||||||
await pay_invoice(wallet_id=wallet.id, payment_request=pr)
|
await pay_invoice(wallet_id=wallet.id, payment_request=pr)
|
||||||
|
|
||||||
g.nursery.start_soon(pay)
|
current_app.nursery.start_soon(pay)
|
||||||
|
|
||||||
balance_notify = request.args.get("balanceNotify")
|
balance_notify = request.args.get("balanceNotify")
|
||||||
if balance_notify:
|
if balance_notify:
|
||||||
|
|
@ -197,7 +198,7 @@ async def lnurlwallet():
|
||||||
user = await get_user(account.id, conn=conn)
|
user = await get_user(account.id, conn=conn)
|
||||||
wallet = await create_wallet(user_id=user.id, conn=conn)
|
wallet = await create_wallet(user_id=user.id, conn=conn)
|
||||||
|
|
||||||
g.nursery.start_soon(
|
current_app.nursery.start_soon(
|
||||||
redeem_lnurl_withdraw,
|
redeem_lnurl_withdraw,
|
||||||
wallet.id,
|
wallet.id,
|
||||||
request.args.get("lightning"),
|
request.args.get("lightning"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue