simple_retry
Version, currently 1.1.03 versions
- 1.1.1latestMar 22, 2021
- 1.1.0not indexedJun 3, 2025
- 1.0.0not indexedJun 3, 2025
github.com/spider-gazelle/simple_retry
a tool for retrying code blocks
8 stars
0 dependents
License: MIT
Nothing has been indexed for 1.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
simple_retry:
github: spider-gazelle/simple_retry
version: ~> 1.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 1.1.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
[](https://travis-ci.com/github/spider-gazelle/simple_retry)
# Simple Retry
A library for managing blocks of code that you might want to retry when an error occurs.
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
simple_retry:
github: spider-gazelle/simple_retry
```
2. Run `shards install`
## Usage
```crystal
require "simple_retry"
SimpleRetry.try_to do
# Something that should succeed eventually
num = rand(10)
raise "bad number #{num}" if num < 5
# Return the number
num
end
```
There are a number of options you can use to customise
```crystal
require "simple_retry"
SimpleRetry.try_to(
# Runs the block at most 5 times
max_attempts: 5,
# Will always stop retrying on these errors
raise_on: DivisionByZeroError | ArgumentError,
# Will only retry on these errors
retry_on: Exception,
# Initial delay time after first retry
base_interval: 10.milliseconds,
# Exponentially increase delay up to this period
max_interval: 10.seconds,
# Adjust the exponential growth by a random amount
randomise: 10.milliseconds
) do |run_count : UInt64, last_error : Exception?, next_delay_time : Time::Span|
# Something that should succeed
end
```
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.1.0- Tagged
- Jun 3, 2025
- Commit
f8cc9f2c969a- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/spider-gazelle/simple_retry
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 3