Hey, great module! I'm using multiple processes to write to an sqlite DB and am running into a busy error:
{ [Error: SQLITE_BUSY: database is locked] errno: 5, code: 'SQLITE_BUSY' }
I would like to have the module wait more than the default 1 second before failing in this case. I see the sqlite3_busy_timeout variable in the src/database.cc code, but I'm unable to tell if it's exposed through the node module. Is it possible to set this busy timeout option? If so, how?
Thanks for the help!
/cc @kkaefer could you comment here? I see database.Configure exposed a busy time option but it lacks tests/not sure if it is working?
As a fallback, something like db.run('PRAGMA busy_timeout = 60000') should work.
db.run('PRAGMA busy_timeout = 60000') doesn't work for me.
Could be that done in another way?
Sqlite busy timeout is described here
using db.configure("busyTimeout", 2000) should set the busy timeout to 2 seconds.
it works, thanks a lot
thanks!!
This method should probably be documented in聽the聽wiki.
Is it possible to set busyTimeout via new Database constructor?
Database#configure is now documented.
@fritx no, busyTimeout must be set on a database instance.
I want to set this timeout in my java project. I see db.configure("busyTimeout", 2000) works but where exactly do we need to implement this? I am not clear on how this can be set in java programs. Any leads? @kkaefer
I want to set this timeout in my java project. I see
db.configure("busyTimeout", 2000)works but where exactly do we need to implement this? I am not clear on how this can be set in java programs. Any leads? @kkaefer
in source code:
void Database::SetBusyTimeout(Baton* baton) {
assert(baton->db->open);
assert(baton->db->_handle);
// Abuse the status field for passing the timeout.
sqlite3_busy_timeout(baton->db->_handle, baton->status);
delete baton;
}
Most helpful comment
using
db.configure("busyTimeout", 2000)should set the busy timeout to 2 seconds.