Closed thuotdwz closed 4 years ago
I think the COMMIT
here shouldn't be uncommented, since there's no transaction involved.
Instead, the Sqlite code should probably be changed and wrapped into a transaction like what is done in MySQLPopQuery.swift
.
If you have the time and willingness to try updating the PR and test it, I'll happily approve and merge the change!
Unfortunately if done in transaction app will hang when using in process worker, I am not sure why this happens :(
That's exactly why SQLite is not supported. To work properly the SQL statements must be wrapped in a transaction, otherwise multiple Queues worker would pickup the same job.
The problem is, when running it in process or a separate worker, you get 2xCpuCores Queues workers, all trying to poll SQLitefor new jobs to run at the same time, which causes a deadlock. SQLite has very limited support for concurrent requests.
The only way SQLite could possibly work is if you only have 1 single Queue worker.
actually I tried with wal mode (PRAGMA journal_mode=WAL;) and single in process worker and seems it is working now with transaction!
so I copied over transaction from mysql as you suggested before and updated the patch
This will allow SQLITE for use in unit testing Fixes #9