Skip to content

Commit

Permalink
Tolerate if the database is (shorty) locked when trying to restore JS…
Browse files Browse the repository at this point in the history
…ON tables to the gravity database

Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Jan 8, 2025
1 parent bc8f073 commit 2c46c88
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/api/teleporter.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ static bool import_json_table(cJSON *json, struct teleporter_files *file)
return false;
}

// Set busy timeout to 1 second to access the database in a
// multi-threaded environment
if(sqlite3_busy_timeout(db, 1000) != SQLITE_OK)
log_warn("import_json_table(%s): Unable to set busy timeout: %s", file->filename, sqlite3_errmsg(db));

// Disable foreign key constraints
if(sqlite3_exec(db, "PRAGMA foreign_keys = OFF;", NULL, NULL, NULL) != SQLITE_OK)
{
Expand Down

0 comments on commit 2c46c88

Please sign in to comment.