Documentation ¶
Overview ¶
Package retry contains utility code for retrying database transactions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
Execute is a wrapper around Retry that can be used for sql queries that don't have any return values.
func Loop ¶
func Loop( ctx context.Context, info HasInfo, fn func(ctx context.Context, sideEffect *Marker) error, ) error
Loop is a convenience wrapper to automatically retry idempotent database operations that experience a transaction or a connection failure. The provided callback may indicate that it has started generating observable effects (e.g. sending result data) by calling its second parameter to disable the retry behavior.
If Loop is called in a reentrant fashion, the retry behavior will be suppressed within an inner loop, allowing the retryable error to percolate into the outer loop.