You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
The project had made a big mistake leading to deadlocks by using a single transaction to findOrCreate. I had avoid it by caching associated objects in memory and had painfully used lots of tedious Promises / async to do careful writings.
Today, by reading the document of SQLite, I noticed that the type of transactions are default to DEFERRED. This was why the deadlocks happened. The solution is quite straightforward; by changing the type to EXCLUSIVE and those operations can be done concurrently like our intuitions.
The project had made a big mistake leading to deadlocks by using a single transaction to
findOrCreate
. I had avoid it by caching associated objects in memory and had painfully used lots of tedious Promises / async to do careful writings.Today, by reading the document of SQLite, I noticed that the type of transactions are default to
DEFERRED
. This was why the deadlocks happened. The solution is quite straightforward; by changing the type toEXCLUSIVE
and those operations can be done concurrently like our intuitions.https://sqlite.org/lang_transaction.html
To use it in sequelize: http://docs.sequelizejs.com/class/lib/transaction.js~Transaction.html#static-get-TYPES
The refactoring can also be painful.
The text was updated successfully, but these errors were encountered: