diff --git a/changedetectionio/worker.py b/changedetectionio/worker.py index ce0744cc..f51f7cbb 100644 --- a/changedetectionio/worker.py +++ b/changedetectionio/worker.py @@ -4,11 +4,9 @@ import changedetectionio.content_fetchers.exceptions as content_fetchers_excepti from changedetectionio.processors.text_json_diff.processor import FilterNotFoundInResponse from changedetectionio import html_tools from changedetectionio import worker_pool -from changedetectionio.flask_app import watch_check_update from changedetectionio.queuedWatchMetaData import PrioritizedItem import asyncio -import importlib import os import sys import time @@ -136,6 +134,8 @@ async def async_update_worker(worker_id, q, notification_q, app, datastore, exec logger.info(f"Worker {worker_id} processing watch UUID {uuid} Priority {queued_item_data.priority} URL {watch['url']}") try: + # Retrieve signal by name to ensure thread-safe access across worker threads + watch_check_update = signal('watch_check_update') watch_check_update.send(watch_uuid=uuid) # Processor is what we are using for detecting the "Change" @@ -521,8 +521,9 @@ async def async_update_worker(worker_id, q, notification_q, app, datastore, exec # Release UUID from processing (thread-safe) worker_pool.release_uuid_from_processing(uuid, worker_id=worker_id) - # Send completion signal + # Send completion signal - retrieve by name to ensure thread-safe access if watch: + watch_check_update = signal('watch_check_update') watch_check_update.send(watch_uuid=watch['uuid']) # Clean up all memory references BEFORE garbage collection