擅长:python、mysql、java
<p>因为您使用的是事务中间件,所以每个请求都有一个不同的事务。在</p>
<blockquote>
<p>The recommended way to handle transactions in Web requests is to tie them to the request and response phases via Django’s TransactionMiddleware.</p>
<p>It works like this: When a request starts, Django starts a transaction. If the response is produced without problems, Django commits any pending transactions. If the view function produces an exception, Django rolls back any pending transactions.</p>
</blockquote>
<p>这意味着,如果第二个进程的请求在写入被触发之前到达,那么它的事务将早于写入。然后,数据库将执行正确的操作并报告创建第二个进程的事务时的当前值。在读取之前手动提交第二个进程的事务是无害的(只要它没有进行任何编辑),并告诉数据库创建一个新的事务。它将在写入日期后写入,因此会给您修改后的结果。在</p>