-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
48 lines (36 loc) · 1.04 KB
/
Copy path__init__.py
File metadata and controls
48 lines (36 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import asyncio
from fastapi import APIRouter
from loguru import logger
from .crud import db
from .tasks import wait_for_paid_invoices
from .views import tagid_generic_router
from .views_api import tagid_api_router
from .views_lnurl import tagid_lnurl_router
tagid_static_files = [
{
"path": "/tagid/static",
"name": "tagid_static",
}
]
tagid_ext: APIRouter = APIRouter(prefix="/tagid", tags=["tagid"])
tagid_ext.include_router(tagid_generic_router)
tagid_ext.include_router(tagid_api_router)
tagid_ext.include_router(tagid_lnurl_router)
scheduled_tasks: list[asyncio.Task] = []
def tagid_stop():
for task in scheduled_tasks:
try:
task.cancel()
except Exception as ex:
logger.warning(ex)
def tagid_start():
from lnbits.tasks import create_permanent_unique_task
task = create_permanent_unique_task("ext_tagid", wait_for_paid_invoices)
scheduled_tasks.append(task)
__all__ = [
"tagid_ext",
"tagid_start",
"tagid_static_files",
"tagid_stop",
"db",
]