Browse Source

fix fucked archiver?

master
eta 3 weeks ago
parent
commit
7485784f1f
  1. 29
      trackernet.lisp

29
trackernet.lisp

@ -1245,20 +1245,25 @@ @@ -1245,20 +1245,25 @@
:if-does-not-exist :create
:if-exists :append)
(dolist (key keys)
(if (and (> (redis-last-score key)
(- (get-universal-time) *train-active-expiry-secs-real*))
(when (and (or (uiop:string-prefix-p "X" key)
(> (redis-last-score key)
(- (get-universal-time) *train-active-expiry-secs-real*)))
(< (redis-sorted-set-length key) *train-live-data-limit*)
(not archive-all))
(multiple-value-bind (new-code dist path timediff)
(maybe-rescue-train key)
(when new-code
(log:info "~Arescued ~A~A => ~A, dist ~,2F, ~As, path ~A"
(bgcol :cyan) key (colreset) new-code dist timediff (format-path path))))
(multiple-value-bind (num-recs last-data unique-tracks)
(archive-train tar key)
(when num-recs
(log:info "~Aarchived ~A~A, ~A recs / ~A uniq-trks, last: ~A"
(bgcol :red) key (colreset) num-recs unique-tracks last-data)))))))
(handler-case
(multiple-value-bind (new-code dist path timediff)
(maybe-rescue-train key)
(when new-code
(log:info "~Arescued ~A~A => ~A, dist ~,2F, ~As, path ~A"
(bgcol :cyan) key (colreset) new-code dist timediff (format-path path))))
(error (e)
(log:error "failed to rescue ~A! ~A" key e)
(statsd-inc "intertube.rescue-fails"))))
(multiple-value-bind (num-recs last-data unique-tracks)
(archive-train tar key)
(when num-recs
(log:info "~Aarchived ~A~A, ~A recs / ~A uniq-trks, last: ~A"
(bgcol :red) key (colreset) num-recs unique-tracks last-data))))))
(defun archive-all-trains ()
"Archive every single currently active train; start afresh with a clean slate."

Loading…
Cancel
Save