Update notification method with new queue system
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Build distribution 📦 (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Test the built 📦 package works basically. (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Publish Python 🐍 distribution 📦 to PyPI (push) Has been cancelled
ChangeDetection.io App Test / lint-code (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-10 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-11 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-12 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-13 (push) Has been cancelled
ChangeDetection.io Container Build Test / Build linux/amd64 (alpine) (push) Has been cancelled
ChangeDetection.io Container Build Test / Build linux/arm64 (alpine) (push) Has been cancelled
ChangeDetection.io Container Build Test / Build linux/amd64 (main) (push) Has been cancelled
ChangeDetection.io Container Build Test / Build linux/arm/v7 (main) (push) Has been cancelled
ChangeDetection.io Container Build Test / Build linux/arm/v8 (main) (push) Has been cancelled
ChangeDetection.io Container Build Test / Build linux/arm64 (main) (push) Has been cancelled
ChangeDetection.io Container Build Test / Build linux/arm64/v8 (main) (push) Has been cancelled

This commit is contained in:
dgtlmoon
2025-08-21 12:56:09 +02:00
parent 97e6933fef
commit 017898d9bc
+12 -7
View File
@@ -18,7 +18,7 @@ def construct_blueprint(datastore: ChangeDetectionStore):
# Watch_uuid could be unset in the case it`s used in tag editor, global settings
import apprise
import queue
from changedetectionio.update_worker import update_worker
from changedetectionio.notification_service import NotificationService
from changedetectionio.notification.apprise_plugin.assets import apprise_asset
from changedetectionio.notification.apprise_plugin.custom_handlers import apprise_http_custom_handler
@@ -96,15 +96,20 @@ def construct_blueprint(datastore: ChangeDetectionStore):
# Create a temporary notification queue for this test
notification_q = queue.Queue()
# Create a temporary update_worker instance just for using queue_notification_for_watch
worker = update_worker(queue.Queue(), notification_q, None, datastore)
# Create notification service directly
notification_service = NotificationService(datastore, notification_q)
# Use queue_notification_for_watch to process the notification with all tokens
worker.queue_notification_for_watch(notification_q, n_object, watch)
# Use the service to queue the notification with all tokens
notification_service.queue_notification_for_watch(n_object, watch)
# Get the notification from the queue and process it
# Get all notifications from the queue and process them
from changedetectionio.notification.handler import process_notification
sent_obj = process_notification(notification_q.get(), datastore)
while not notification_q.empty():
try:
notification_obj = notification_q.get_nowait()
sent_obj = process_notification(notification_obj, datastore)
except queue.Empty:
break
except Exception as e:
e_str = str(e)