add the main tasks to scheduled_tasks and make dem deinitilize on api_stop
This commit is contained in:
parent
37b48b7c0c
commit
38e5eeece0
2 changed files with 14 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from typing import List
|
||||
from fastapi import APIRouter
|
||||
from starlette.staticfiles import StaticFiles
|
||||
|
||||
|
|
@ -17,6 +18,8 @@ nostrclient_static_files = [
|
|||
|
||||
nostrclient_ext: APIRouter = APIRouter(prefix="/nostrclient", tags=["nostrclient"])
|
||||
|
||||
scheduled_tasks: List[asyncio.Task] = []
|
||||
|
||||
|
||||
def nostr_renderer():
|
||||
return template_renderer(["lnbits/extensions/nostrclient/templates"])
|
||||
|
|
@ -29,5 +32,7 @@ from .views_api import * # noqa
|
|||
|
||||
def nostrclient_start():
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.create_task(catch_everything_and_restart(init_relays))
|
||||
loop.create_task(catch_everything_and_restart(subscribe_events))
|
||||
task1 = loop.create_task(catch_everything_and_restart(init_relays))
|
||||
scheduled_tasks.append(task1)
|
||||
task2 = loop.create_task(catch_everything_and_restart(subscribe_events))
|
||||
scheduled_tasks.append(task2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue