Browse Source

add function to clear out the clickhouse failure queue

master
eta 2 months ago
parent
commit
68de647d2a
  1. 15
      trackernet.lisp

15
trackernet.lisp

@ -4086,3 +4086,18 @@ Return four values: a set of nodes, edges, weights, and a new->old edge mapping. @@ -4086,3 +4086,18 @@ Return four values: a set of nodes, edges, weights, and a new->old edge mapping.
for ltid in (get-all "lt:*")
when (eql (red:ttl ltid) -1)
collect ltid))
(defun clear-clickhouse-queue ()
"Clear the queue of clickhouse failures."
;; make sure we have a connection first
(assert (string= "PONG" (red:ping)))
(loop
for train = (red:spop "clickhouse-failures")
while train
do (handler-bind
((serious-condition
(lambda (c)
(declare (ignore c))
(log:warn "reinserting train into failures due to condition")
(red:sadd "clickhouse-failures" train))))
(clickhouse-insert-live (cpk-unbase64 train)))))

Loading…
Cancel
Save