Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: stream operator throttle typo #1348

Merged
merged 4 commits into from
May 28, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Limit the throughput to a specific number of elements per time unit, or a specif

## Description

Limit the throughput to a specific number of elements per time unit, or a specific total cost per time unit, where
Limit the throughput to a specific number of elements per time unit, or a specific total cost per-time unit, where
Roiocam marked this conversation as resolved.
Show resolved Hide resolved
a function has to be provided to calculate the individual cost of each element.

The throttle operator combines well with the @ref[`queue`](./../Source/queue.md) operator to adapt the speeds on both ends of the `queue`-`throttle` pair.
Expand All @@ -21,7 +21,7 @@ See also @ref:[Buffers and working with rate](../../stream-rate.md) for related
## Example

Imagine the server end of a streaming platform. When a client connects and request a video content, the server
should return the content. Instead of serving a complete video as fast as bandwith allows, `throttle` can be used
should return the content. Instead of serving a complete video as fast as bandwidth allows, `throttle` can be used
to limit the network usage to 24 frames per second (let's imagine this streaming platform stores frames, not bytes).

Scala
Expand All @@ -41,8 +41,8 @@ Scala
Java
: @@snip [Throttle.java](/docs/src/test/java/jdocs/stream/operators/sourceorflow/Throttle.java) { #throttle-with-burst }

The extra argument to set the `ThrottleMode` to `shaping` tells `throttle` to make pauses to avoid exceeding
the maximum rate. Alternatively we could set the throttling mode to cause a stream failure when upstream is faster
The extra argument to set the `ThrottleMode` to `shaping` tells throttle to make pauses to avoid exceeding
the maximum rate. Alternatively we could set the `ThrottleMode` to `enforcing` cause a stream failure when upstream is faster
Roiocam marked this conversation as resolved.
Show resolved Hide resolved
than the throttle rate.

The examples above don't cover all the parameters supported by `throttle` (e.g. `cost`-based throttling). See the
Expand Down