Fixed race condition between celery and db, by adding a delay and a retry option