Celery and transaction.atomic

后端 未结 3 1157
庸人自扰
庸人自扰 2021-02-04 04:39

In some Django views, I used a pattern like this to save changes to a model, and then to do some asynchronous updating (such as generating images, further altering the model) ba

3条回答
  •  被撕碎了的回忆
    2021-02-04 04:53

    "Separate task" = something that is ran by a worker.

    "Celery worker" = another process.

    I am not aware of any method that would let you have a single database transaction shared between 2 or more processess. What you want is to run the task in a synchronous way, in that transaction, and wait for the result... but, if that's what you want, why do you need a task queue anyway?

提交回复
热议问题