I am running my Django app inside of a docker. I am using a background job as well as a periodic job with Celery + RabbitMQ, running in separate containers from the main app.
Everything works locally with "heroku local".
When running my app on an Ubuntu instance on Digital Ocean, I noticed that the background task and periodic task are executing old versions of my code. Specifically, I removed a field from my Django model last week, and the old code was referencing that deleted field so an error occurs. However, my new code no longer makes any reference to the missing field.
Here are a few things I tried:
- rebuild and restart docker (didn't work)
- delete all .pyc files (didn't work)
- purge all celery tasks (didn't work)
- Restart my digital ocean instance (didn't work)
- Moving all my code and docker environment to a brand new digital ocean instance. (THIS WORKED!)
I have encountered this problems twice now, and I am hoping to find a better solution than moving to a new machine every time this error happens. I am guessing that Celery or RabbitMQ has cached the old code somewhere that I was not aware of.
Thanks in advance!
Related to this but non of the solutions worked for me: Celery/Rabbitmq/Django - Old tasks being executed without being called in my code