* automatic throttle burst size, #24699 * throttleEven used maxBurst=Int.MaxValue, which in practise resulted in no throttling at all at high rates * The original problem that throttleEven tried to solve was that when the throttle rate (cost / per) was high the cost of scheduling dominated and became much lower than the given rate, if 0 or low maxBurst was given. Difficult for user to know what maxBurst to use. * In fact, that was already the case for rates > 30/s. * This is fixed by automatically adjusting the maxBurst for higher throttle rates in a new throttle overload that doesn't include maxBurst parameter * Also skipped the mode parameter for that variant since Shaping is what almost always is what you want, and otherwise you can use the full signature with a good maxBurst * Deprecated throttleEven, since it is the same. Also fixed the implementation of throttleEven to use the automatic burst size, since Int.MaxValue is not useful at all.
This commit is contained in:
parent
ee85d23a3e
commit
6f330ef69c
14 changed files with 692 additions and 364 deletions
|
|
@ -10,6 +10,7 @@ import akka.japi.function
|
|||
import akka.japi.Util
|
||||
import akka.stream._
|
||||
import akka.util.ConstantFun
|
||||
import akka.util.JavaDurationConverters._
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.annotation.unchecked.uncheckedVariance
|
||||
|
|
@ -620,10 +621,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
* `n` must be positive, and `d` must be greater than 0 seconds, otherwise
|
||||
* IllegalArgumentException is thrown.
|
||||
*/
|
||||
def groupedWithin(n: Int, d: java.time.Duration): SubSource[java.util.List[Out @uncheckedVariance], Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def groupedWithin(n: Int, d: java.time.Duration): SubSource[java.util.List[Out @uncheckedVariance], Mat] =
|
||||
groupedWithin(n, d.asScala)
|
||||
}
|
||||
|
||||
/**
|
||||
* Chunk up this stream into groups of elements received within a time window,
|
||||
|
|
@ -666,10 +665,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
* `maxWeight` must be positive, and `d` must be greater than 0 seconds, otherwise
|
||||
* IllegalArgumentException is thrown.
|
||||
*/
|
||||
def groupedWeightedWithin(maxWeight: Long, costFn: function.Function[Out, java.lang.Long], d: java.time.Duration): javadsl.SubSource[java.util.List[Out @uncheckedVariance], Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def groupedWeightedWithin(maxWeight: Long, costFn: function.Function[Out, java.lang.Long], d: java.time.Duration): javadsl.SubSource[java.util.List[Out @uncheckedVariance], Mat] =
|
||||
groupedWeightedWithin(maxWeight, costFn, d.asScala)
|
||||
}
|
||||
|
||||
/**
|
||||
* Discard the given number of elements at the beginning of the stream.
|
||||
|
|
@ -713,10 +710,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def dropWithin(d: java.time.Duration): SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def dropWithin(d: java.time.Duration): SubSource[Out, Mat] =
|
||||
dropWithin(d.asScala)
|
||||
}
|
||||
|
||||
/**
|
||||
* Terminate processing (and cancel the upstream publisher) after predicate
|
||||
|
|
@ -831,10 +826,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
* @param of time to shift all messages
|
||||
* @param strategy Strategy that is used when incoming elements cannot fit inside the buffer
|
||||
*/
|
||||
def delay(of: java.time.Duration, strategy: DelayOverflowStrategy): SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def delay(of: java.time.Duration, strategy: DelayOverflowStrategy): SubSource[Out, Mat] =
|
||||
delay(of.asScala, strategy)
|
||||
}
|
||||
|
||||
/**
|
||||
* Recover allows to send last element on failure and gracefully complete the stream
|
||||
|
|
@ -980,10 +973,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels or timer fires
|
||||
*/
|
||||
def takeWithin(d: java.time.Duration): SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def takeWithin(d: java.time.Duration): SubSource[Out, Mat] =
|
||||
takeWithin(d.asScala)
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows a faster upstream to progress independently of a slower subscriber by conflating elements into a summary
|
||||
|
|
@ -1516,10 +1507,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def initialTimeout(timeout: java.time.Duration): SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def initialTimeout(timeout: java.time.Duration): SubSource[Out, Mat] =
|
||||
initialTimeout(timeout.asScala)
|
||||
}
|
||||
|
||||
/**
|
||||
* If the completion of the stream does not happen until the provided timeout, the stream is failed
|
||||
|
|
@ -1550,10 +1539,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def completionTimeout(timeout: java.time.Duration): SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def completionTimeout(timeout: java.time.Duration): SubSource[Out, Mat] =
|
||||
completionTimeout(timeout.asScala)
|
||||
}
|
||||
|
||||
/**
|
||||
* If the time between two processed elements exceeds the provided timeout, the stream is failed
|
||||
|
|
@ -1586,10 +1573,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def idleTimeout(timeout: java.time.Duration): SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def idleTimeout(timeout: java.time.Duration): SubSource[Out, Mat] =
|
||||
idleTimeout(timeout.asScala)
|
||||
}
|
||||
|
||||
/**
|
||||
* If the time between the emission of an element and the following downstream demand exceeds the provided timeout,
|
||||
|
|
@ -1622,10 +1607,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def backpressureTimeout(timeout: java.time.Duration): SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def backpressureTimeout(timeout: java.time.Duration): SubSource[Out, Mat] =
|
||||
backpressureTimeout(timeout.asScala)
|
||||
}
|
||||
|
||||
/**
|
||||
* Injects additional elements if upstream does not emit for a configured amount of time. In other words, this
|
||||
|
|
@ -1666,10 +1649,41 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def keepAlive(maxIdle: java.time.Duration, injectedElem: function.Creator[Out]): SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def keepAlive(maxIdle: java.time.Duration, injectedElem: function.Creator[Out]): SubSource[Out, Mat] =
|
||||
keepAlive(maxIdle.asScala, injectedElem)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends elements downstream with speed limited to `elements/per`. In other words, this stage set the maximum rate
|
||||
* for emitting messages. This combinator works for streams where all elements have the same cost or length.
|
||||
*
|
||||
* Throttle implements the token bucket model. There is a bucket with a given token capacity (burst size).
|
||||
* Tokens drops into the bucket at a given rate and can be `spared` for later use up to bucket capacity
|
||||
* to allow some burstiness. Whenever stream wants to send an element, it takes as many
|
||||
* tokens from the bucket as element costs. If there isn't any, throttle waits until the
|
||||
* bucket accumulates enough tokens. Elements that costs more than the allowed burst will be delayed proportionally
|
||||
* to their cost minus available tokens, meeting the target rate. Bucket is full when stream just materialized and
|
||||
* started.
|
||||
*
|
||||
* The burst size is calculated based on the given rate (`cost/per`) as 0.1 * rate, for example:
|
||||
* - rate < 20/second => burst size 1
|
||||
* - rate 20/second => burst size 2
|
||||
* - rate 100/second => burst size 10
|
||||
* - rate 200/second => burst size 20
|
||||
*
|
||||
* The throttle `mode` is [[akka.stream.ThrottleMode.Shaping]], which makes pauses before emitting messages to
|
||||
* meet throttle rate.
|
||||
*
|
||||
* '''Emits when''' upstream emits an element and configured time per each element elapsed
|
||||
*
|
||||
* '''Backpressures when''' downstream backpressures or the incoming rate is higher than the speed limit
|
||||
*
|
||||
* '''Completes when''' upstream completes
|
||||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
*/
|
||||
def throttle(elements: Int, per: java.time.Duration): javadsl.SubSource[Out, Mat] =
|
||||
new SubSource(delegate.throttle(elements, per.asScala))
|
||||
|
||||
/**
|
||||
* Sends elements downstream with speed limited to `elements/per`. In other words, this stage set the maximum rate
|
||||
|
|
@ -1692,10 +1706,11 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* WARNING: Be aware that throttle is using scheduler to slow down the stream. This scheduler has minimal time of triggering
|
||||
* next push. Consequently it will slow down the stream as it has minimal pause for emitting. This can happen in
|
||||
* case burst is 0 and speed is higher than 30 events per second. You need to consider another solution in case you are expecting
|
||||
* events being evenly spread with some small interval (30 milliseconds or less).
|
||||
* In other words the throttler always enforces the rate limit, but in certain cases (mostly due to limited scheduler resolution) it
|
||||
* enforces a tighter bound than what was prescribed. This can be also mitigated by increasing the burst size.
|
||||
* case burst is 0 and speed is higher than 30 events per second. You need to increase the `maximumBurst` if
|
||||
* elements arrive with small interval (30 milliseconds or less). Use the overloaded `throttle` method without
|
||||
* `maximumBurst` parameter to automatically calculate the `maximumBurst` based on the given rate (`cost/per`).
|
||||
* In other words the throttler always enforces the rate limit when `maximumBurst` parameter is given, but in
|
||||
* certain cases (mostly due to limited scheduler resolution) it enforces a tighter bound than what was prescribed.
|
||||
*
|
||||
* '''Emits when''' upstream emits an element and configured time per each element elapsed
|
||||
*
|
||||
|
|
@ -1705,7 +1720,6 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
* @see [[#throttleEven]]
|
||||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.12")
|
||||
|
|
@ -1734,10 +1748,11 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* WARNING: Be aware that throttle is using scheduler to slow down the stream. This scheduler has minimal time of triggering
|
||||
* next push. Consequently it will slow down the stream as it has minimal pause for emitting. This can happen in
|
||||
* case burst is 0 and speed is higher than 30 events per second. You need to consider another solution in case you are expecting
|
||||
* events being evenly spread with some small interval (30 milliseconds or less).
|
||||
* In other words the throttler always enforces the rate limit, but in certain cases (mostly due to limited scheduler resolution) it
|
||||
* enforces a tighter bound than what was prescribed. This can be also mitigated by increasing the burst size.
|
||||
* case burst is 0 and speed is higher than 30 events per second. You need to increase the `maximumBurst` if
|
||||
* elements arrive with small interval (30 milliseconds or less). Use the overloaded `throttle` method without
|
||||
* `maximumBurst` parameter to automatically calculate the `maximumBurst` based on the given rate (`cost/per`).
|
||||
* In other words the throttler always enforces the rate limit when `maximumBurst` parameter is given, but in
|
||||
* certain cases (mostly due to limited scheduler resolution) it enforces a tighter bound than what was prescribed.
|
||||
*
|
||||
* '''Emits when''' upstream emits an element and configured time per each element elapsed
|
||||
*
|
||||
|
|
@ -1747,13 +1762,46 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
* @see [[#throttleEven]]
|
||||
*/
|
||||
def throttle(elements: Int, per: java.time.Duration, maximumBurst: Int,
|
||||
mode: ThrottleMode): javadsl.SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
throttle(elements, per.asScala, maximumBurst, mode)
|
||||
}
|
||||
mode: ThrottleMode): javadsl.SubSource[Out, Mat] =
|
||||
new SubSource(delegate.throttle(elements, per.asScala, maximumBurst, mode))
|
||||
|
||||
/**
|
||||
* Sends elements downstream with speed limited to `cost/per`. Cost is
|
||||
* calculating for each element individually by calling `calculateCost` function.
|
||||
* This combinator works for streams when elements have different cost(length).
|
||||
* Streams of `ByteString` for example.
|
||||
*
|
||||
* Throttle implements the token bucket model. There is a bucket with a given token capacity (burst size).
|
||||
* Tokens drops into the bucket at a given rate and can be `spared` for later use up to bucket capacity
|
||||
* to allow some burstiness. Whenever stream wants to send an element, it takes as many
|
||||
* tokens from the bucket as element costs. If there isn't any, throttle waits until the
|
||||
* bucket accumulates enough tokens. Elements that costs more than the allowed burst will be delayed proportionally
|
||||
* to their cost minus available tokens, meeting the target rate. Bucket is full when stream just materialized and
|
||||
* started.
|
||||
*
|
||||
* The burst size is calculated based on the given rate (`cost/per`) as 0.1 * rate, for example:
|
||||
* - rate < 20/second => burst size 1
|
||||
* - rate 20/second => burst size 2
|
||||
* - rate 100/second => burst size 10
|
||||
* - rate 200/second => burst size 20
|
||||
*
|
||||
* The throttle `mode` is [[akka.stream.ThrottleMode.Shaping]], which makes pauses before emitting messages to
|
||||
* meet throttle rate.
|
||||
*
|
||||
* '''Emits when''' upstream emits an element and configured time per each element elapsed
|
||||
*
|
||||
* '''Backpressures when''' downstream backpressures or the incoming rate is higher than the speed limit
|
||||
*
|
||||
* '''Completes when''' upstream completes
|
||||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
*/
|
||||
def throttle(cost: Int, per: java.time.Duration,
|
||||
costCalculation: function.Function[Out, Integer]): javadsl.SubSource[Out, Mat] =
|
||||
new SubSource(delegate.throttle(cost, per.asScala, costCalculation.apply _))
|
||||
|
||||
/**
|
||||
* Sends elements downstream with speed limited to `cost/per`. Cost is
|
||||
|
|
@ -1779,10 +1827,11 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* WARNING: Be aware that throttle is using scheduler to slow down the stream. This scheduler has minimal time of triggering
|
||||
* next push. Consequently it will slow down the stream as it has minimal pause for emitting. This can happen in
|
||||
* case burst is 0 and speed is higher than 30 events per second. You need to consider another solution in case you are expecting
|
||||
* events being evenly spread with some small interval (30 milliseconds or less).
|
||||
* In other words the throttler always enforces the rate limit, but in certain cases (mostly due to limited scheduler resolution) it
|
||||
* enforces a tighter bound than what was prescribed. This can be also mitigated by increasing the burst size.
|
||||
* case burst is 0 and speed is higher than 30 events per second. You need to increase the `maximumBurst` if
|
||||
* elements arrive with small interval (30 milliseconds or less). Use the overloaded `throttle` method without
|
||||
* `maximumBurst` parameter to automatically calculate the `maximumBurst` based on the given rate (`cost/per`).
|
||||
* In other words the throttler always enforces the rate limit when `maximumBurst` parameter is given, but in
|
||||
* certain cases (mostly due to limited scheduler resolution) it enforces a tighter bound than what was prescribed.
|
||||
*
|
||||
* '''Emits when''' upstream emits an element and configured time per each element elapsed
|
||||
*
|
||||
|
|
@ -1792,7 +1841,6 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
* @see [[#throttleEven]]
|
||||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.12")
|
||||
|
|
@ -1824,10 +1872,11 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* WARNING: Be aware that throttle is using scheduler to slow down the stream. This scheduler has minimal time of triggering
|
||||
* next push. Consequently it will slow down the stream as it has minimal pause for emitting. This can happen in
|
||||
* case burst is 0 and speed is higher than 30 events per second. You need to consider another solution in case you are expecting
|
||||
* events being evenly spread with some small interval (30 milliseconds or less).
|
||||
* In other words the throttler always enforces the rate limit, but in certain cases (mostly due to limited scheduler resolution) it
|
||||
* enforces a tighter bound than what was prescribed. This can be also mitigated by increasing the burst size.
|
||||
* case burst is 0 and speed is higher than 30 events per second. You need to increase the `maximumBurst` if
|
||||
* elements arrive with small interval (30 milliseconds or less). Use the overloaded `throttle` method without
|
||||
* `maximumBurst` parameter to automatically calculate the `maximumBurst` based on the given rate (`cost/per`).
|
||||
* In other words the throttler always enforces the rate limit when `maximumBurst` parameter is given, but in
|
||||
* certain cases (mostly due to limited scheduler resolution) it enforces a tighter bound than what was prescribed.
|
||||
*
|
||||
* '''Emits when''' upstream emits an element and configured time per each element elapsed
|
||||
*
|
||||
|
|
@ -1837,13 +1886,10 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
* @see [[#throttleEven]]
|
||||
*/
|
||||
def throttle(cost: Int, per: java.time.Duration, maximumBurst: Int,
|
||||
costCalculation: function.Function[Out, Integer], mode: ThrottleMode): javadsl.SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
throttle(cost, per.asScala, maximumBurst, costCalculation, mode)
|
||||
}
|
||||
costCalculation: function.Function[Out, Integer], mode: ThrottleMode): javadsl.SubSource[Out, Mat] =
|
||||
new SubSource(delegate.throttle(cost, per.asScala, maximumBurst, costCalculation.apply _, mode))
|
||||
|
||||
/**
|
||||
* This is a simplified version of throttle that spreads events evenly across the given time interval.
|
||||
|
|
@ -1856,24 +1902,9 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
* @see [[#throttle]]
|
||||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.12")
|
||||
@deprecated("Use throttle without `maximumBurst` parameter instead.", "2.5.12")
|
||||
def throttleEven(elements: Int, per: FiniteDuration, mode: ThrottleMode): javadsl.SubSource[Out, Mat] =
|
||||
new SubSource(delegate.throttle(elements, per, Int.MaxValue, mode))
|
||||
|
||||
/**
|
||||
* This is a simplified version of throttle that spreads events evenly across the given time interval.
|
||||
*
|
||||
* Use this combinator when you need just slow down a stream without worrying about exact amount
|
||||
* of time between events.
|
||||
*
|
||||
* If you want to be sure that no time interval has no more than specified number of events you need to use
|
||||
* [[throttle()]] with maximumBurst attribute.
|
||||
* @see [[#throttle]]
|
||||
*/
|
||||
def throttleEven(elements: Int, per: java.time.Duration, mode: ThrottleMode): javadsl.SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
throttleEven(elements, per.asScala, mode)
|
||||
}
|
||||
new SubSource(delegate.throttleEven(elements, per, mode))
|
||||
|
||||
/**
|
||||
* This is a simplified version of throttle that spreads events evenly across the given time interval.
|
||||
|
|
@ -1886,10 +1917,25 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
* @see [[#throttle]]
|
||||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.12")
|
||||
@deprecated("Use throttle without `maximumBurst` parameter instead.", "2.5.12")
|
||||
def throttleEven(elements: Int, per: java.time.Duration, mode: ThrottleMode): javadsl.SubSource[Out, Mat] =
|
||||
throttleEven(elements, per.asScala, mode)
|
||||
|
||||
/**
|
||||
* This is a simplified version of throttle that spreads events evenly across the given time interval.
|
||||
*
|
||||
* Use this combinator when you need just slow down a stream without worrying about exact amount
|
||||
* of time between events.
|
||||
*
|
||||
* If you want to be sure that no time interval has no more than specified number of events you need to use
|
||||
* [[throttle()]] with maximumBurst attribute.
|
||||
* @see [[#throttle]]
|
||||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use throttle without `maximumBurst` parameter instead.", "2.5.12")
|
||||
def throttleEven(cost: Int, per: FiniteDuration,
|
||||
costCalculation: (Out) ⇒ Int, mode: ThrottleMode): javadsl.SubSource[Out, Mat] =
|
||||
new SubSource(delegate.throttle(cost, per, Int.MaxValue, costCalculation.apply _, mode))
|
||||
new SubSource(delegate.throttleEven(cost, per, costCalculation.apply _, mode))
|
||||
|
||||
/**
|
||||
* This is a simplified version of throttle that spreads events evenly across the given time interval.
|
||||
|
|
@ -1901,11 +1947,11 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
* [[throttle()]] with maximumBurst attribute.
|
||||
* @see [[#throttle]]
|
||||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use throttle without `maximumBurst` parameter instead.", "2.5.12")
|
||||
def throttleEven(cost: Int, per: java.time.Duration,
|
||||
costCalculation: (Out) ⇒ Int, mode: ThrottleMode): javadsl.SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
costCalculation: (Out) ⇒ Int, mode: ThrottleMode): javadsl.SubSource[Out, Mat] =
|
||||
throttleEven(cost, per.asScala, costCalculation, mode)
|
||||
}
|
||||
|
||||
/**
|
||||
* Detaches upstream demand from downstream demand without detaching the
|
||||
|
|
@ -1948,10 +1994,8 @@ class SubSource[Out, Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source[O
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def initialDelay(delay: java.time.Duration): SubSource[Out, Mat] = {
|
||||
import akka.util.JavaDurationConverters._
|
||||
def initialDelay(delay: java.time.Duration): SubSource[Out, Mat] =
|
||||
initialDelay(delay.asScala)
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the attributes of this [[Source]] to the given ones and seal the list
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue