Skip to content

Commit

Permalink
Create lockfile in advance outside filelock
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Apr 14, 2020
1 parent e24abf6 commit 4bf8876
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions R/txtq.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,13 @@ R6_txtq <- R6::R6Class(
if (!file.exists(private$total_file)) {
private$txtq_set_total(0)
}
file_create(private$lock_file)
})
private$txtq_validate()
},
txtq_exclusive = function(code) {
on.exit(filelock::unlock(lock))
lock <- filelock::lock(private$lock_file)
on.exit({
filelock::unlock(lock)
unlink(private$lock_file)
})
force(code)
},
txtq_get_head = function() {
Expand Down

0 comments on commit 4bf8876

Please sign in to comment.