-
-
Notifications
You must be signed in to change notification settings - Fork 256
Labels
Description
Describe the bug
When the celery worker executes openwisp_controller.connection.tasks.update_config, it incorrectly detects that another worker is executing the task, when in reality it is the same worker running it. As a result, the worker returns early, skipping the actual execution even though it is the correct one to run the task.
Steps To Reproduce
Steps to reproduce the behavior:
- Change the configuration of device (e.g. change name or configuration)
- Observe the log/output during the task's execution from the celery worker.
- Notice that the task exits/returns early, incorrectly assuming another worker is executing it, despite being run by the current worker itself.
Expected behavior
The celery worker should correctly detect if another worker is running the task, and should proceed with execution when it is indeed the task's actual worker.
openwisp-controller/openwisp_controller/connection/tasks.py
Lines 19 to 28 in cbdb3c6
| def _is_update_in_progress(device_id): | |
| active = current_app.control.inspect().active() | |
| if not active: | |
| return False | |
| # check if there's any other running task before adding it | |
| for task_list in active.values(): | |
| for task in task_list: | |
| if task["name"] == _TASK_NAME and str(device_id) in task["args"]: | |
| return True | |
| return False |