During rabbit asynchronous processing, mysql read an unfinished data and reported an error.

Application scenario:
the client uploads the file and the django server writes a piece of status=1 data in the database. Then give it to rabbit to read the file and parse it. After parsing, set status to 2. The transmission format of
rabbitmq is {"file": "test", "dataSourceId": "1"} . Because the id, is passed, sometimes rabbitmq will mistakenly report that there is no such record.
this is the way to write data
clipboard.png
sleep

clipboard.png

I would like to ask how to make the rabbitmq program wait until django has finished writing the data before reading it? Or there are other ideas to avoid not being able to read the data

Mar.18,2021
The general meaning of

is that I understand, that is, it is an asynchronous operation, and there is no guarantee that it will be completed sequentially.
I can provide an idea. Whether it is possible to set a global variable flag, after the completion of an operation, modify the value of flag, according to the value to determine whether there can be a record of id.

Menu