class RateLimiter extends WaitingExecutionQueue
An rate limiter pool backed by a priority queue. It rate limits the executions and the priority queue is ordered by the Ordering defined on the SchedulingContext.
The implementation is based on the tokens bucket algorithm.
- Alphabetic
- By Inheritance
- RateLimiter
- WaitingExecutionQueue
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
RateLimiter(tokens: Int, refillRateInMs: Int)
- tokens
Maximum (and initial) number of tokens.
- refillRateInMs
A token is added to the bucket every
refillRateInMs
milliseconds.
Type Members
-
case class
DelayedResult
[A](effect: () ⇒ Future[A], effectDebug: String, promise: Promise[A], submitted: Instant, started: Ref[Option[Instant]] = Ref(None)) extends Product with Serializable
- Definition Classes
- WaitingExecutionQueue
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
lazy val
_running: Ref[Set[(Execution[_], DelayedResult[_])]]
- Definition Classes
- WaitingExecutionQueue
-
lazy val
_waiting: Ref[SortedSet[(Execution[_], DelayedResult[_])]]
- Definition Classes
- WaitingExecutionQueue
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
canRunNextCondition(implicit txn: InTxn): Boolean
- Definition Classes
- RateLimiter → WaitingExecutionQueue
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
doRunNext()(implicit txn: InTxn): Unit
- Definition Classes
- RateLimiter → WaitingExecutionQueue
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
routes(urlPrefix: String): PartialFunction[Request, Future[Response]]
- Definition Classes
- RateLimiter → WaitingExecutionQueue
-
def
run[A, S <: Scheduling](execution: Execution[S], debug: String)(f: () ⇒ Future[A]): Future[A]
- Definition Classes
- WaitingExecutionQueue
-
def
runNext(): Unit
- Definition Classes
- WaitingExecutionQueue
-
def
running: Set[Execution[_]]
- Definition Classes
- WaitingExecutionQueue
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
implicit
def
taskEncoder[A]: Encoder[DelayedResult[A]]
- Definition Classes
- WaitingExecutionQueue
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
waiting: Set[Execution[_]]
- Definition Classes
- WaitingExecutionQueue