FS2 Throttler
Throttling for FS2 based on the Token bucket algorithm.
This implementation supports:
- burst in the processing of elements
- calculates a cost for every element of the stream
- two throttle modes (Shaping / Enforcing)
Install
libraryDependencies += "dev.kovstas" % "fs2-throttler" % Version
Usage
import dev.kovstas.fs2throttler.Throttler._
stream.through(throttle(1, 1.second, Shaping))
More examples you can find in tests.