set_retry

Call v151 → current #6

Configure retry behavior for a scheduled task if it fails.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: developersanalytics

The Big Picture

Retry configuration lets failed tasks automatically reschedule rather than failing silently.

Use Cases

  • Add resilience to scheduled operations
  • Implement retry logic for transient failures

From Chain Metadata

Set a retry configuration for a task so that, in case its scheduled run fails, it will be retried after `period` blocks, for a total amount of `retries` retries or until it succeeds. Tasks which need to be scheduled for a retry are still subject to weight metering and agenda space, same as a regular task. If a periodic task fails, it will be scheduled normally while the task is retrying. Tasks scheduled as a result of a retry for a periodic task are unnamed, non-periodic clones of the original task. Their retry configuration will be derived from the original task's configuration, but will have a lower value for `remaining` than the original `total_retries`.

Input Parameters

#NameTypeDescription
0
task
(u32, u32) TaskAddress<BlockNumberFor<T>>task ((u32, u32))
1
retries
u8 retries (u8)
2
period
u32 BlockNumberFor<T>period: Block number

Permissions

Origin
Unknown
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Task exists at (block, index)
  • Period at least 1 block

Effects

Events Emitted

Storage Modified

Postconditions

  • RetryConfig set in Retries storage

Side Effects

  • Emits RetrySet event
  • Failed executions will reschedule

Code Examples

// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Build set_retry call (typed, named args)
const task = undefined as any /* (u32, u32) — replace with real value */;
const retries = 0;
const period = 0;

const tx = api.tx.Scheduler.set_retry({
  task,
  retries,
  period,
});

Runtime Info

Pallet Index
15
Call Index
6
First Version
v151
Current Version
v411