{"id":15713780,"url":"https://github.com/taylorfinnell/retrycr","last_synced_at":"2025-10-27T22:43:45.218Z","repository":{"id":145628755,"uuid":"117021638","full_name":"taylorfinnell/retrycr","owner":"taylorfinnell","description":"Retry blocks of Crystal code","archived":false,"fork":false,"pushed_at":"2021-04-13T04:53:45.000Z","size":6,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-27T22:43:44.907Z","etag":null,"topics":["crystal","crystal-language","crystal-shard"],"latest_commit_sha":null,"homepage":null,"language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taylorfinnell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-10T23:02:56.000Z","updated_at":"2025-08-27T12:15:25.000Z","dependencies_parsed_at":"2023-04-27T16:01:56.080Z","dependency_job_id":null,"html_url":"https://github.com/taylorfinnell/retrycr","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/taylorfinnell/retrycr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorfinnell%2Fretrycr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorfinnell%2Fretrycr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorfinnell%2Fretrycr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorfinnell%2Fretrycr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taylorfinnell","download_url":"https://codeload.github.com/taylorfinnell/retrycr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taylorfinnell%2Fretrycr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281355366,"owners_count":26486896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crystal","crystal-language","crystal-shard"],"created_at":"2024-10-03T21:33:27.608Z","updated_at":"2025-10-27T22:43:45.204Z","avatar_url":"https://github.com/taylorfinnell.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# retrycr\n[![Build Status](https://travis-ci.org/taylorfinnell/retrycr.svg?branch=master)](https://travis-ci.org/taylorfinnell/retrycr)\n\nRetry blocks of Crystal code.\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  retrycr:\n    github: taylorfinnell/retrycr\n```\n\n## Usage\n\n```crystal\nrequire \"retrycr\"\n```\n\nRetry all exceptions.\n\n```crystal\nretryable(tries: 1, wait: 1) do\n  # my code\nend\n```\n\nYou may specify which `Exception` classes trigger a retry.\n```crystal\nretryable(on: ArgumentError | Base64::Error, tries: 1, wait: 1) do\n  # my code\nend\n```\n\nThe *wait* parameter can either be an `Int32` or a `Proc`.\n```crystal\nretryable(tries: 1, wait: -\u003e(x : Int32) { 2**x }) do\n  # my code\nend\n```\n\nThe number of retries that have happened is yielded to the block.\n```crystal\nretryable(tries: 1, wait: 1) do |retries|\n  puts \"There have been #{retries} retries!\"\nend\n```\n\nYou can specify a callback to run everytime the code is retried.\n```crystal\ncallback = -\u003e (ex : Exeption) { \"The code is about to be retried!\" }\nretryable(tries: 1, wait: 1, callback: callback) do |retries|\n  puts \"There have been #{retries} retries!\"\nend\n```\n\nYou can specify a callback to run after all retries are exhausted.\n```crystal\nf = File.open(\"test\")\ncallback = -\u003e (retries : Int32) { f.close }\nretryable(tries: 1, wait: 1, finally: callback) do |retries|\n  f.read\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaylorfinnell%2Fretrycr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaylorfinnell%2Fretrycr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaylorfinnell%2Fretrycr/lists"}