PADFoundationretrybackoffresiliencefoundationerror-handlingtransient-errorsexponential-backoff
Retry With Backoff
Wraps any flaky action in a retry loop with configurable max attempts and exponential backoff (2s, 4s, 8s). Ideal for web scraping waits, API calls, file locks, or any action that can fail transiently. Logs each attempt and breaks on success.
0 copies
Section 1: Configure Retry Parameters
Section 2: Retry Loop with Exponential Backoff
Section 3: Evaluate Retry Outcome
Usage Notes
- Replace
REPLACE_WITH_ACTION_NAMEwith a descriptive name for the action being retried (e.g.,$'''Graph API Token Request''') - Place the action(s) that may fail transiently inside the
BLOCK RetryAction— the comment marks the insertion point - The
SET boolRetrySuccess TO Trueline inside the block runs only if no error occurs — it acts as the success signal to exit the loop - Backoff doubles each attempt: 2s → 4s → 8s by default. Adjust
numBaseDelaySecfor faster or slower retry cadences - Adjust
numMaxRetriesbased on the action — use 3 for API calls, 5 for file locks, 2 for quick checks - After the loop, check
boolRetrySuccessto determine if the action ultimately succeeded or all retries were exhausted strRetryErrorcontains the last error message if all retries fail — use it in downstream error logging- This pattern works well inside the Error Handler Wrapper for nested resilience (retry first, then escalate)
Requirements
- No external dependencies — uses only built-in PAD loop, block, and wait actions
- The action placed inside the retry block must be idempotent (safe to repeat without side effects)
WAITaction requires PAD flow control actions (included in all PAD versions)- For API-based retries, ensure the endpoint supports repeated requests (most REST APIs do)
- Error variable
LastErroris a built-in PAD object available inside ON BLOCK ERROR handlers