浏览代码

Log gathertweet action start/end

simplify
父节点
当前提交
26ee9c1e5c
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. +5
    -2
      inst/gathertweet.R

+ 5
- 2
inst/gathertweet.R 查看文件

@@ -47,16 +47,18 @@ if (args$`--debug-args`) {
}

library(gathertweet)
action <- names(Filter(isTRUE, args[c("search", "update")]))

if (args$polite) {
lockfile <- paste0(".gathertweet_",
digest::digest(args[c("file", "search", "update")]),
".lock")
lck <- filelock::lock(lockfile, exclusive = TRUE, timeout = 0)
action <- names(Filter(isTRUE, args[c("search", "update")]))
gathertweet:::stopifnot_locked(lck, "Another gathertweet {action} process is currently running for {args$file}")
}

log_info("---- gathertweet {action} start ----")

# Search ------------------------------------------------------------------
if (isTRUE(args$search)) {

@@ -113,7 +115,6 @@ if (isTRUE(args$search)) {
if (args$backup) backup_tweets(args$file, backup_dir = args[["backup-dir"]])
tweets <- save_tweets(tweets, args$file)
log_debug("Total of {nrow(tweets)} tweets in {args$file}")
log_info("Tweet update complete")

}

@@ -121,3 +122,5 @@ if (args$polite) {
filelock::unlock(lck)
unlink(lockfile)
}

log_info("---- gathertweet {action} complete ----")

正在加载...
取消
保存