-*- mode: org; mode: visual-line; mode: adaptive-wrap-prefix; -*-
- In
chime.clj
, line 39ff:If we are blocked on the channel write, the head of
more-times
might now be in the past, which will blow up the nextms-between
. Two options: push through all times anyway (i.e. skip the delays until we’ve caught up), or discard any past times before we loop. This patch does the latter, but in any case it’s always possible to get a time in the past since one value can always be pending in the channel. (There should perhaps be another named argument tochime-ch
to specify catch-up vs. discard.)Code which exhibits the bug:
(let [ch (chime-ch (periodic-seq (-> (t/now) (.withMillisOfSecond 0)) (-> 1 t/seconds)))] (a/<!! ch) (a/<!! (a/timeout 5000)) (a/<!! ch) ; Pending timestamp comes through in the past. (a/<!! ch)) ; Hang (server has fallen over prior to this).
Arguably, clients should be using sliding/dropping buffers if they’re not going to pick up times immediately, but the existing code is bombing out the REPL, which isn’t nice.