brunoV / throttler

Control the throughput of function calls and core.async channels
286 stars 27 forks source link

Accurate rate calculation #12

Open liath opened 5 years ago

liath commented 5 years ago

Per #11, some rates aren't possible due to rounding and we can't specify sub-10ms in core.async/timeout because of how it buckets requests. Per @dball's advice on the clojurians Slack I took a swing at replacing timeout with java.util.concurrent.ScheduledExecutorService. It fairly accurately represents the lower values from #11 correctly but I'm not confident it's the best solution. It breaks one of this projects goals of not needing an additional thread and I'd really rather @brunoV signed off on that.

I'd love to have the script that was used to generate the table in the README for comparison...