james-henderson/chime — pull request #3 by rockolo (2014-01-19 18:18:30+00:00)
Title: Evaluate (t/now) only once per go-loop iteration.

Because `(ms-until [time])` previously evaluated `(t/now)`
again, and the `drop-while` uses a different `(t/now)`,
there were (rare) occurrences where the `(t/now)` in
`(ms-until [time])` evaluated to a time later than
the time that got passed, resulting in a negative
interval and a `java.lang.IllegalArgumentException:
The end instant must be greater or equal to the start`

I renamed (ms-until) to (ms-between) as it now
also requires the start-time as a parameter.

The fix can be tested by starting a lot of periodic
chimes at once. e.g. evaluating a lot of
```clojure
(def periodic-chime
(chime-at (periodic-seq
(t/now)
(t/seconds 2))
#(println "Chiming!" %)))
```

Without the fix, you will get to see the exception
eventually by starting a lot of periodic chimes.

Thanks for the great concise library, a new release
(0.1.4) including the fix would be greatly appreciated.