config/cron/job: Fix load when currency.units has not been created yet
parent
8152c884ba
commit
0cd8a1acac
|
@ -1,4 +1,4 @@
|
||||||
;; -*- mode: Lisp; -*-
|
;; -*- mode: scheme; -*-
|
||||||
|
|
||||||
;; This cannot be let-bound within `job'.
|
;; This cannot be let-bound within `job'.
|
||||||
(define currency-file (string-append (getenv "HOME") "/.cache/currency.units"))
|
(define currency-file (string-append (getenv "HOME") "/.cache/currency.units"))
|
||||||
|
@ -6,7 +6,9 @@
|
||||||
(job
|
(job
|
||||||
(lambda (current-time)
|
(lambda (current-time)
|
||||||
(let* ((seconds-in-a-day (* 60 60 24))
|
(let* ((seconds-in-a-day (* 60 60 24))
|
||||||
(currency-time (stat:mtime (stat currency-file))))
|
(currency-time (if (not (file-exists? currency-file))
|
||||||
|
0
|
||||||
|
(stat:mtime (stat currency-file)))))
|
||||||
(if (< currency-time (- current-time seconds-in-a-day))
|
(if (< currency-time (- current-time seconds-in-a-day))
|
||||||
;; Use next-minute to avoid overwhelming the system in case of failure.
|
;; Use next-minute to avoid overwhelming the system in case of failure.
|
||||||
(next-minute)
|
(next-minute)
|
||||||
|
|
Loading…
Reference in New Issue