chore: remove unused env and new create unique task
remove old scheduled tasks approach update min version Update __init__.py Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
parent
a8dc4ac5df
commit
65732f7aa0
3 changed files with 11 additions and 22 deletions
17
__init__.py
17
__init__.py
|
|
@ -1,13 +1,11 @@
|
|||
import asyncio
|
||||
from typing import List
|
||||
|
||||
from environs import Env
|
||||
from fastapi import APIRouter
|
||||
from loguru import logger
|
||||
|
||||
from lnbits.db import Database
|
||||
from lnbits.helpers import template_renderer
|
||||
from lnbits.tasks import catch_everything_and_restart
|
||||
from lnbits.tasks import create_permanent_unique_task
|
||||
|
||||
|
||||
db = Database("ext_lnurlp")
|
||||
|
|
@ -26,22 +24,25 @@ lnurlp_redirect_paths = [
|
|||
}
|
||||
]
|
||||
|
||||
scheduled_tasks: List[asyncio.Task] = []
|
||||
|
||||
lnurlp_ext: APIRouter = APIRouter(prefix="/lnurlp", tags=["lnurlp"])
|
||||
|
||||
|
||||
def lnurlp_renderer():
|
||||
return template_renderer(["lnurlp/templates"])
|
||||
|
||||
|
||||
from .lnurl import * # noqa: F401,F403
|
||||
from .tasks import wait_for_paid_invoices
|
||||
from .views import * # noqa: F401,F403
|
||||
from .views_api import * # noqa: F401,F403
|
||||
|
||||
|
||||
scheduled_tasks: List[asyncio.Task] = []
|
||||
|
||||
|
||||
def lnurlp_stop():
|
||||
for task in scheduled_tasks:
|
||||
task.cancel()
|
||||
|
||||
def lnurlp_start():
|
||||
loop = asyncio.get_event_loop()
|
||||
task = loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|
||||
task = create_permanent_unique_task("lnurlp", wait_for_paid_invoices)
|
||||
scheduled_tasks.append(task)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue