retry
Package retry provides retry strategy configuration for durable programs.
retry
Functions
constant(t: Duration)
Example:
retry.constant(time.SECOND)
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
t | Duration | ✓ |
Returns: Strategy
exponential(t: Duration)
Example:
retry.exponential(time.SECOND)
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
t | Duration | ✓ |
Returns: Strategy
fibonacci(t: Duration)
Example:
retry.fibonacci(time.SECOND)
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
t | Duration | ✓ |
Returns: Strategy
with_jitter(jitter: Duration, strategy: Strategy)
Example:
retry.with_jitter(time.SECOND, retry.constant(time.SECOND * 5))
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
jitter | Duration | ✓ | |
strategy | Strategy | ✓ |
Returns: Strategy
with_jitter_percent(jitter: Int, strategy: Strategy)
Example:
retry.with_jitter_percent(10, retry.constant(time.SECOND * 5))
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
jitter | Int | ✓ | |
strategy | Strategy | ✓ |
Returns: Strategy
with_max_retries(max: Int, strategy: Strategy)
Example:
retry.with_max_retries(3, retry.constant(time.SECOND))
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
max | Int | ✓ | |
strategy | Strategy | ✓ |
Returns: Strategy
with_capped_duration(cap: Duration, strategy: Strategy)
Example:
retry.with_capped_duration(time.MINUTE, retry.exponential(time.SECOND))
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
cap | Duration | ✓ | |
strategy | Strategy | ✓ |
Returns: Strategy
with_max_duration(timeout: Duration, strategy: Strategy)
Example:
retry.with_max_duration(time.MINUTE * 5, retry.exponential(time.SECOND))
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
timeout | Duration | ✓ | |
strategy | Strategy | ✓ |
Returns: Strategy