Skip to content

Commit

Permalink
Set a busy handler for dbUpdate() and dbSelect()
Browse files Browse the repository at this point in the history
  • Loading branch information
jthompson-arcus committed Mar 22, 2024
1 parent b834371 commit fc51619
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions R/utils_get_db.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dbSelect <- function(query, db_name = golem::get_golem_options('assessment_db_na
errFlag <- FALSE
con <- DBI::dbConnect(RSQLite::SQLite(), db_name)

RSQLite::sqliteSetBusyHandler(con, 3000)
tryCatch(
expr = {
rs <- DBI::dbSendQuery(con, glue::glue_sql(query, .envir = .envir, .con = con))
Expand Down
1 change: 1 addition & 0 deletions R/utils_insert_db.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dbUpdate <- function(command, db_name = golem::get_golem_options('assessment_db_
errFlag <- FALSE
con <- DBI::dbConnect(RSQLite::SQLite(), db_name)

RSQLite::sqliteSetBusyHandler(con, 3000)
tryCatch({
rs <- DBI::dbSendStatement(con, glue::glue_sql(command, .envir = .envir, .con = con))
if (!is.null(params))
Expand Down

0 comments on commit fc51619

Please sign in to comment.