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
|
|
@ -9,7 +9,7 @@ from starlette.exceptions import HTTPException
|
|||
from lnbits.decorators import check_admin
|
||||
from lnbits.helpers import urlsafe_short_hash
|
||||
|
||||
from . import nostrclient_ext
|
||||
from . import nostrclient_ext, scheduled_tasks
|
||||
from .crud import add_relay, delete_relay, get_relays
|
||||
from .models import Relay, RelayList
|
||||
from .services import NostrRouter, nostr
|
||||
|
|
@ -92,6 +92,12 @@ async def api_stop():
|
|||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
for scheduled_task in scheduled_tasks:
|
||||
try:
|
||||
scheduled_task.cancel()
|
||||
except Exception as ex:
|
||||
logger.warning(ex)
|
||||
|
||||
return {"success": True}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue