mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-21 06:03:12 +00:00
Set sqlite temp directory explicitly, increase database timeout
This commit is contained in:
parent
7978bc0b1a
commit
09617b9ce0
@ -194,6 +194,13 @@ int rhizome_opendb()
|
|||||||
RETURN(WHY("No Directory"));
|
RETURN(WHY("No Directory"));
|
||||||
}
|
}
|
||||||
char dbpath[1024];
|
char dbpath[1024];
|
||||||
|
if (!sqlite3_temp_directory){
|
||||||
|
if (!FORM_RHIZOME_DATASTORE_PATH(dbpath, "")){
|
||||||
|
RETURN(WHY("Invalid path"));
|
||||||
|
}
|
||||||
|
sqlite3_temp_directory = sqlite3_mprintf("%s", dbpath);
|
||||||
|
}
|
||||||
|
|
||||||
if (!FORM_RHIZOME_DATASTORE_PATH(dbpath, "rhizome.db")){
|
if (!FORM_RHIZOME_DATASTORE_PATH(dbpath, "rhizome.db")){
|
||||||
RETURN(WHY("Invalid path"));
|
RETURN(WHY("Invalid path"));
|
||||||
}
|
}
|
||||||
@ -251,6 +258,10 @@ int rhizome_close_db()
|
|||||||
{
|
{
|
||||||
IN();
|
IN();
|
||||||
if (rhizome_db) {
|
if (rhizome_db) {
|
||||||
|
if (!sqlite3_get_autocommit(rhizome_db)){
|
||||||
|
WHY("Uncommitted transaction!");
|
||||||
|
sqlite_exec_void("ROLLBACK;");
|
||||||
|
}
|
||||||
sqlite3_stmt *stmt = NULL;
|
sqlite3_stmt *stmt = NULL;
|
||||||
while ((stmt = sqlite3_next_stmt(rhizome_db, stmt))) {
|
while ((stmt = sqlite3_next_stmt(rhizome_db, stmt))) {
|
||||||
const char *sql = sqlite3_sql(stmt);
|
const char *sql = sqlite3_sql(stmt);
|
||||||
@ -307,7 +318,7 @@ int rhizome_close_db()
|
|||||||
sqlite_retry_state sqlite_retry_state_init(int serverLimit, int serverSleep, int otherLimit, int otherSleep)
|
sqlite_retry_state sqlite_retry_state_init(int serverLimit, int serverSleep, int otherLimit, int otherSleep)
|
||||||
{
|
{
|
||||||
return (sqlite_retry_state){
|
return (sqlite_retry_state){
|
||||||
.limit = serverMode ? (serverLimit < 0 ? 50 : serverLimit) : (otherLimit < 0 ? 1500 : otherLimit),
|
.limit = serverMode ? (serverLimit < 0 ? 50 : serverLimit) : (otherLimit < 0 ? 5000 : otherLimit),
|
||||||
.sleep = serverMode ? (serverSleep < 0 ? 10 : serverSleep) : (otherSleep < 0 ? 100 : otherSleep),
|
.sleep = serverMode ? (serverSleep < 0 ? 10 : serverSleep) : (otherSleep < 0 ? 100 : otherSleep),
|
||||||
.elapsed = 0,
|
.elapsed = 0,
|
||||||
.start = -1,
|
.start = -1,
|
||||||
|
Loading…
Reference in New Issue
Block a user