r-lib / liteq
Showing 2 of 2 files from the diff.

@@ -23,7 +23,7 @@
Loading
23 23
  lock <- message_lock_file(lockdir, queue, id)
24 24
  con <- db_connect(lock)
25 25
  db_execute(con, "CREATE TABLE foo (id INT)")
26 -
  db_execute(con, "BEGIN EXCLUSIVE")
26 +
  db_execute(con, "BEGIN IMMEDIATE")
27 27
28 28
  structure(
29 29
    list(

@@ -71,7 +71,9 @@
Loading
71 71
do_db_execute <- function(db, query, ...) {
72 72
  con <- db_connect(db)
73 73
  on.exit(dbDisconnect(con))
74 +
  db_lock(con)
74 75
  db_execute(con, query, ...)
76 +
  db_execute(con, "COMMIT")
75 77
}
76 78
77 79
db_lock <- function(con) {
@@ -79,7 +81,7 @@
Loading
79 81
  while (!done) {
80 82
    tryCatch(
81 83
      {
82 -
        dbExecute(con, "BEGIN EXCLUSIVE")
84 +
        dbExecute(con, "BEGIN IMMEDIATE")
83 85
        done <- TRUE
84 86
      },
85 87
      error = function(e) NULL
@@ -171,18 +173,18 @@
Loading
171 173
db_publish <- function(db, queue, title, message) {
172 174
  con <- db_connect(db)
173 175
  on.exit(dbDisconnect(con))
174 -
  dbWithTransaction(con, {
175 -
    for (i in seq_along(title)) {
176 -
      db_execute(
177 -
        con,
178 -
        "INSERT INTO ?tablename (title, message)
179 -
         VALUES (?title, ?message)",
180 -
        tablename = db_queue_name(queue),
181 -
        title = title[i],
182 -
        message = message[i]
183 -
      )
184 -
    }
185 -
  })
176 +
  db_lock(con)
177 +
  for (i in seq_along(title)) {
178 +
    db_execute(
179 +
      con,
180 +
      "INSERT INTO ?tablename (title, message)
181 +
       VALUES (?title, ?message)",
182 +
      tablename = db_queue_name(queue),
183 +
      title = title[i],
184 +
      message = message[i]
185 +
    )
186 +
  }
187 +
  db_execute(con, "COMMIT")
186 188
  invisible()
187 189
}
188 190
Files Coverage
R 0.00%
Project Totals (5 files) 0.00%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading