django-q
django-q copied to clipboard
Why am I getting 'ERROR database is locked' with SQLite so often?
I am using SQLite and I am often getting [Q] ERROR database is locked
.
I already set the workers
to 1
in settings to avoid multi-tasking, but it still seems to start the next task before ending the previous one.
I also set my SQLite database settings to have 'OPTIONS': {'timeout': 1000.0,}
but it doesn't seem to have an effect.
So anyone knows how to stop simultaneous/async tasks and fix the database locking problem?
SQLite isn't a database server but file based, so not suitable for multi-concurrency. Even if you put workers to 1, the django process needs access too so you'll always have more than one process accessing the same file. You should use a dedicated database server (Postgres / MySQL) for this to work.