From dc7a6551c5e87589c7851973304323e257f54ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Fri, 16 Feb 2024 12:48:50 +0100 Subject: [PATCH] chore: deprecate get_current_extension_name (#2280) --- lnbits/helpers.py | 4 ++++ lnbits/tasks.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/lnbits/helpers.py b/lnbits/helpers.py index 356f97f08..3135c43cf 100644 --- a/lnbits/helpers.py +++ b/lnbits/helpers.py @@ -92,6 +92,10 @@ def template_renderer(additional_folders: Optional[List] = None) -> Jinja2Templa def get_current_extension_name() -> str: """ + DEPRECATED: Use the repo name instead, will be removed in the future + before: `register_invoice_listener(invoice_queue, get_current_extension_name())` + after: `register_invoice_listener(invoice_queue, "my-extension")` + Returns the name of the extension that calls this method. """ import inspect diff --git a/lnbits/tasks.py b/lnbits/tasks.py index 8af1d752d..3a565449d 100644 --- a/lnbits/tasks.py +++ b/lnbits/tasks.py @@ -86,6 +86,8 @@ class SseListenersDict(dict): invoice_listeners: Dict[str, asyncio.Queue] = SseListenersDict("invoice_listeners") +# TODO: name should not be optional +# some extensions still dont use a name, but they should def register_invoice_listener(send_chan: asyncio.Queue, name: Optional[str] = None): """ A method intended for extensions (and core/tasks.py) to call when they want to be