I am working with a Django backend and I need to check the status of multiple Celery Tasks () every 3 seconds.
For instance, let's say I have 4 task IDs:
- 3099023
- 3493494
- 4309349
- 5498458
My goal is to make an http.get<...>(backend) call every 3 seconds for each ID until the state of the task is "FINISHED." The polling should stop once a task is finished.
Is there a straightforward way to accomplish this?
I attempted to implement this using a for loop:
- Iterate through the list of IDs
- Create a timer for each individual ID
- Poll the status of the ID by making an HTTP call to the backend within each timer
- Continue polling if the response indicates that the task is not yet finished, otherwise stop polling