Sometimes we have to run background tasks with a quite long duration time. However, the RabbitMQ has a default time limitation for waiting the ack. If the execution time is exceed, you will got an error message like “Delivery acknowledgement timeouts” and your channel will be broken.
Continue readingPost Category → Web Development
Laravel MySQL Query Return Empty When there is a Deadlock
Suppose you have two processes executing the following PHP code at the same time, what results will be printed?
1 2 3 |
\DB::transaction(function (){ dump(User::where('id',1)->lockForUpdate()->first()); }); |
Surprisingly, one process prints the query results, while another process prints an empty collection (array). The code that returned an empty collection did not trigger a deadlock exception as expected.
Continue reading