Browse Source

fix race condition, improve error reporting

master
eta 2 weeks ago
parent
commit
528d45b87f
  1. 30
      trackernet.lisp

30
trackernet.lisp

@ -928,16 +928,23 @@ @@ -928,16 +928,23 @@
(cutoff (- (get-universal-time) *train-active-expiry-secs*)))
(delete-if-not (lambda (train)
(if (string= "X" (subseq train 0 1))
;; XR special archival rules: only archive for age
;; or the train being marked as deleted
(or
(< (redis-first-score train) age-cutoff)
(and
(uiop:string-prefix-p "X-DEL" (car (redis-last-cpk train)))
;; don't *immediately* delete trains marked
;; as deleted; wait 3 seconds (see above) for
;; something to be interposed there
(< (redis-last-score train) xr-cutoff)))
;; FIXME(eta): there's a race condition where the
;; train can get rescued midway through this
;; function :(
(let ((fs (redis-first-score train))
(ls (redis-last-score train))
(data (redis-last-cpk train)))
(when (and fs ls data)
;; XR special archival rules: only archive for age
;; or the train being marked as deleted
(or
(< fs age-cutoff)
(and
(uiop:string-prefix-p "X-DEL" (car data))
;; don't *immediately* delete trains marked
;; as deleted; wait 3 seconds (see above) for
;; something to be interposed there
(< ls xr-cutoff)))))
(or
(< (redis-first-score train) age-cutoff)
(< (redis-last-score train) cutoff))))
@ -1710,7 +1717,8 @@ @@ -1710,7 +1717,8 @@
"http://metrics.i.eta.st:6001/send"
:method :post
:content (format nil "eta: [intertube error] ~A (on thread ~A)"
condition
(substitute #\Space #\Newline
(princ-to-string condition))
(sb-thread:thread-name sb-thread:*current-thread*))))
(trivial-backtrace:print-backtrace condition)
(sb-ext:exit :abort t))

Loading…
Cancel
Save