retrycr
Version, currently 0.1.03 versions
- 0.1.3latestApr 13, 2021
- 0.1.1not indexedApr 13, 2021
- 0.1.0not indexedApr 13, 2021
github.com/taylorfinnell/retrycr
Retry blocks of Crystal code
Nothing has been indexed for 0.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:
retrycr:
github: taylorfinnell/retrycr
version: ~> 0.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.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.
retrycr
Retry blocks of Crystal code.
Installation
Add this to your application's shard.yml:
dependencies:
retrycr:
github: taylorfinnell/retrycr
Usage
require "retrycr"
Retry all exceptions.
retryable(tries: 1, wait: 1) do
# my code
end
You may specify which Exception classes trigger a retry.
retryable(on: ArgumentError | Base64::Error, tries: 1, wait: 1) do
# my code
end
The wait parameter can either be an Int32 or a Proc.
retryable(tries: 1, wait: ->(x : Int32) { 2**x }) do
# my code
end
The number of retries that have happened is yielded to the block.
retryable(tries: 1, wait: 1) do |retries|
puts "There have been #{retries} retries!"
end
You can specify a callback to run everytime the code is retried.
callback = -> (ex : Exeption) { "The code is about to be retried!" }
retryable(tries: 1, wait: 1, callback: callback) do |retries|
puts "There have been #{retries} retries!"
end
You can specify a callback to run after all retries are exhausted.
f = File.open("test")
callback = -> (retries : Int32) { f.close }
retryable(tries: 1, wait: 1, finally: callback) do |retries|
f.read
end
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Apr 13, 2021
- Commit
fc884f3af637- Indexed
- not yet
Dependents
Repository
github.com/taylorfinnell/retrycr
Metadata
- Created
- Aug 12, 2026
- Updated
- Oct 15, 2026
- Synced
- Oct 15, 2026
- Versions
- 3