diff options
| author | Ivar Refsdal <refsdal.ivar@gmail.com> | 2022-03-27 18:39:44 +0200 |
|---|---|---|
| committer | Ivar Refsdal <refsdal.ivar@gmail.com> | 2022-03-27 18:39:44 +0200 |
| commit | 6c26a3b6871286510bb8e9770ee7f7e3abf97abe (patch) | |
| tree | e5b831db0f727c77255df58edd7e07275c7bb4d0 /src/com/github/ivarref/yoltq/error_poller.clj | |
| parent | Document (diff) | |
| download | fiinha-6c26a3b6871286510bb8e9770ee7f7e3abf97abe.tar.gz fiinha-6c26a3b6871286510bb8e9770ee7f7e3abf97abe.tar.xz | |
Start use current millis in the database, not nano offset
Diffstat (limited to 'src/com/github/ivarref/yoltq/error_poller.clj')
| -rw-r--r-- | src/com/github/ivarref/yoltq/error_poller.clj | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/com/github/ivarref/yoltq/error_poller.clj b/src/com/github/ivarref/yoltq/error_poller.clj index 1268482..ee6359e 100644 --- a/src/com/github/ivarref/yoltq/error_poller.clj +++ b/src/com/github/ivarref/yoltq/error_poller.clj @@ -22,7 +22,7 @@ state :recovery}} {:keys [system-error-min-count system-error-callback-backoff] :or {system-error-min-count 3}} - now-ns + now-ms error-count] (let [new-errors (->> (conj errors error-count) (take-last system-error-min-count) @@ -50,14 +50,14 @@ (when (and (= old-state :recovery) (= new-state :error)) {:run-callback :error - :last-notify now-ns}) + :last-notify now-ms}) (when (and (= new-state :error) (= old-state :error) - (> now-ns + (> now-ms (+ last-notify system-error-callback-backoff))) {:run-callback :error - :last-notify now-ns}) + :last-notify now-ms}) (when (and (= new-state :recovery) (= old-state :error)) @@ -88,7 +88,7 @@ (log/debug "poll-errors found" error-count "errors in system") (reset! healthy? false)) (reset! healthy? true)) - (let [{:keys [run-callback] :as new-state} (swap! system-error handle-error-count config (ext/now-ns) error-count)] + (let [{:keys [run-callback] :as new-state} (swap! system-error handle-error-count config (ext/now-ms) error-count)] (when run-callback (cond (= run-callback :error) (on-system-error) |
