Browse Source

use max age instead of live data length limit

master
eta 2 months ago
parent
commit
445b041ef3
  1. 7
      trackernet.lisp

7
trackernet.lisp

@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
(defparameter *rude-requests-per-minute* 300)
(defparameter *rescue-ptr-expiry-secs* (* 60 60 3))
(defparameter *train-live-data-limit* 40000)
(defparameter *max-train-age-secs* (* 60 60 24))
(defparameter *rescue-max-dist* 10.0)
(defparameter *rescue-timediff-threshold* -15)
(defparameter *max-trackernet-data-age-secs* 300)
@ -900,13 +901,13 @@ @@ -900,13 +901,13 @@
(length (get-trains pred)))))))
(defun get-archivable-trains ()
"Returns a list of all trains that were last updated more than *TRAIN-ACTIVE-EXPIRY-SECS* ago, or have too many records."
"Returns a list of all trains that were last updated more than *TRAIN-ACTIVE-EXPIRY-SECS* ago, or were created more than *MAX-TRAIN-AGE-SECS* ago."
(let* ((trains (get-all "?-train-*"))
(age-cutoff (- (get-universal-time) *max-train-age-secs*))
(cutoff (- (get-universal-time) *train-active-expiry-secs*)))
(delete-if-not (lambda (train)
(or
;; (> (redis-sorted-set-length train)
;; *train-live-data-limit*)
(< (redis-first-score train) age-cutoff)
(< (redis-last-score train) cutoff)))
trains)))

Loading…
Cancel
Save