Skip to content

Commit bf1ba35

Browse files
committed
[fix:connection/tasks] Ignore current task instance when checking active tasks - #1204
The _is_update_in_progress function was incorrectly detecting the current Celery task as another running task, causing update_config to exit early. This fix excludes the current task by comparing task IDs, ensuring only other instances for the same device are considered. Added tests to cover same worker (should not skip) and different worker (should skip) scenarios. Additionally, added INFO-level logging to convey when a task is skipped because another task is in progress.
1 parent 7394bd8 commit bf1ba35

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

openwisp_controller/connection/tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def update_config(device_id):
5353
logger.warning(f'update_config("{device_id}") failed: {e}')
5454
return
5555
if _is_update_in_progress(device_id):
56+
logger.info(f"Skipping update_config for device {device_id} as another task is in progress.")
5657
return
5758
try:
5859
device_conn = DeviceConnection.get_working_connection(device)

0 commit comments

Comments
 (0)