Flow Control
enables you to limit the number of calls made to your workflow by delaying the delivery.
There are two main use cases for Flow-Control in Workflow:
period
parameter). All calls sharing the same FlowControl
key count toward this limit. Instead of rejecting calls that exceed the rate, QStash automatically queues and delays them to ensure the limit is respected.FlowControl
, you need to choose a key first. This key is used to count the number of calls made to your endpoint.
There are not limits to number of keys you can use.
url
, they are applied per Flow-Control-Key
.publishes
has not delivered but there are also the publishes
with the new rates, QStash will effectively allow
the highest rate/period or highest parallelism. Eventually(after the old publishes are delivered), the new rate/period and parallelism will be used.serve
and trigger
methods.
When configured, all the steps of the workflow will respect the limits.
Due to the nature of the Workflow SDK, QStash calls the serve
method multiple times. This means that to stay within the limits
of the deployed environments, the given rate will be applied to all calls going from QStash servers to the serve
method.
Note that if there are multiple Workflows running in the same environment, their steps can interleave, but overall rate and parallelism limits will be respected
if they share the same flowControl
key.
serve
method:flowControl
documentation under serve
parameters.
trigger
method:trigger
, see the documentation here.
context.call
: