2

I'm seeing a bizarre problem with a Django app which uses Celery as as the task queue:

  1. I kick off a task.
  2. During execution, the task calls update_state(...) to set the task state to indicate progress.
  3. The task completes. I verify this through logs.

However, this view (http://myapp/tasks/37d9a3ac-5bd2-4791-9729-2234ff3be762/status) returns a STALE result for a variable amount of time well after the task has completed. I can repro this using both Redis and database as the back-end. Eventually the task state is returned correctly, but this really breaks my app because the UI polls to see if the task is completed before the user can do anything.

EDIT: my app is deployed on Heroku. I wonder if Cedar does any response caching??

Any idea what's going on?

Bilal and Olga
  • 3,211
  • 6
  • 30
  • 33

1 Answers1

1

It turns out this was not related to Celery. It was happening because my AJAX query to task/{id}/status was getting cached by the browser. Telling jQuery to not cache the response did the trick!

Bilal and Olga
  • 3,211
  • 6
  • 30
  • 33