An API call or operation is “idempotent” if it has the same result when called more than once.
idempotencyKey
twice, the second request will not create a new task run.
idempotencyKey
option is not available when using
triggerAndWait
or batchTriggerAndWait
, due to a bug that would sometimes cause the parent task
to become stuck. We are working on a fix for this issue.idempotencyKey
optionidempotencyKey
to ensure that a task is only triggered once with the same key. This is useful if you are triggering a task within another task that might be retried:
idempotencyKeys.create
SDK function to create an idempotency key before passing it to the options
object.
We automatically inject the run ID when generating the idempotency key when running inside a task by default. You can turn it off by passing the scope
option to idempotencyKeys.create
:
idempotencyKeys.create
SDK function to create an idempotency key.
idempotencyKey
option, without first creating it with idempotencyKeys.create
.
idempotencyKey
when calling batchTrigger
as well:
idempotencyKeyTTL
optionidempotencyKeyTTL
option defines a time window during which a task with the same idempotency key will only run once. Here’s how it works:
idempotencyKeyTTL: "5m"
, it creates a 5-minute window.idempotencyKeyTTL
option when triggering a task:
idempotencyKeyTTL
option:
s
for seconds (e.g. 60s
)m
for minutes (e.g. 5m
)h
for hours (e.g. 2h
)d
for days (e.g. 3d
)