Skip to content

Commit

Permalink
Updated listener task to most recent
Browse files Browse the repository at this point in the history
  • Loading branch information
arcbtc committed Jun 5, 2024
1 parent dcd50f3 commit d5347a5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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_myextension")
Expand All @@ -30,7 +30,15 @@ def myextension_renderer():
from .views import *
from .views_api import *

scheduled_tasks: list[asyncio.Task] = []

def myextension_stop():
for task in scheduled_tasks:
try:
task.cancel()
except Exception as ex:
logger.warning(ex)

def myextension_start():
loop = asyncio.get_event_loop()
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
task = create_permanent_unique_task("ext_myextension", wait_for_paid_invoices)
scheduled_tasks.append(task)

0 comments on commit d5347a5

Please sign in to comment.