{"id":29210644,"url":"https://github.com/embarkstudios/tryhard","last_synced_at":"2025-07-02T21:07:24.926Z","repository":{"id":46994304,"uuid":"312799774","full_name":"EmbarkStudios/tryhard","owner":"EmbarkStudios","description":"💫 Easily retry futures 🦀","archived":false,"fork":false,"pushed_at":"2025-06-23T12:58:24.000Z","size":59,"stargazers_count":212,"open_issues_count":3,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-23T13:50:44.068Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EmbarkStudios.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-14T11:07:28.000Z","updated_at":"2025-06-23T12:58:28.000Z","dependencies_parsed_at":"2024-06-21T13:28:42.144Z","dependency_job_id":"c1e99bda-c2a6-42f3-821a-1ef56be4a649","html_url":"https://github.com/EmbarkStudios/tryhard","commit_stats":{"total_commits":42,"total_committers":9,"mean_commits":4.666666666666667,"dds":"0.33333333333333337","last_synced_commit":"9722f18b0ae170b7d046d4032b955588ad699e3d"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":"EmbarkStudios/opensource-template","purl":"pkg:github/EmbarkStudios/tryhard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftryhard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftryhard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftryhard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftryhard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EmbarkStudios","download_url":"https://codeload.github.com/EmbarkStudios/tryhard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftryhard/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263215299,"owners_count":23431895,"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","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":[],"created_at":"2025-07-02T21:07:24.052Z","updated_at":"2025-07-02T21:07:24.917Z","avatar_url":"https://github.com/EmbarkStudios.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💫 tryhard\n\n[![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](https://embark.dev)\n[![Embark](https://img.shields.io/badge/discord-ark-%237289da.svg?logo=discord)](https://discord.gg/dAuKfZS)\n[![Crates.io](https://img.shields.io/crates/v/tryhard.svg)](https://crates.io/crates/tryhard)\n[![Docs](https://docs.rs/tryhard/badge.svg)](https://docs.rs/tryhard)\n[![dependency status](https://deps.rs/repo/github/EmbarkStudios/tryhard/status.svg)](https://deps.rs/repo/github/EmbarkStudios/tryhard)\n[![Build status](https://github.com/EmbarkStudios/tryhard/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/tryhard/actions)\n\n`tryhard` makes it easy to retry futures that might fail. You can control the number of retries, the backoff strategy, and the max duration.\n\n## Examples\n\nFirst imagine you have some async function that can fail:\n\n```rust\nasync fn read_file(path: \u0026str) -\u003e Result\u003cString, std::io::Error\u003e {\n    // ...\n}\n```\n\nCalling that function and retrying at most 10 times with no delay between attempts can be done like so:\n\n```rust\ntryhard::retry_fn(|| read_file(\"Cargo.toml\"))\n    .retries(10)\n    .await?;\n```\n\nYou can also retry with a fixed delay between attempts:\n\n```rust\ntryhard::retry_fn(|| read_file(\"Cargo.toml\"))\n    .retries(10)\n    .fixed_backoff(Duration::from_millis(100))\n    .await?;\n```\n\nOr exponential backoff, where the delay doubles each time, with a max delay of 1 second:\n\n```rust\ntryhard::retry_fn(|| read_file(\"Cargo.toml\"))\n    .retries(10)\n    .exponential_backoff(Duration::from_millis(10))\n    .max_delay(Duration::from_secs(1))\n    .await?;\n```\n\nSee [the docs](https://docs.rs/tryhard) for more details.\n\n## Contributing\n\n[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v2.0-ff69b4.svg)](../main/CODE_OF_CONDUCT.md)\n\nWe welcome community contributions to this project.\n\nPlease read our [Contributor Guide](CONTRIBUTING.md) for more information on how to get started.\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembarkstudios%2Ftryhard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fembarkstudios%2Ftryhard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembarkstudios%2Ftryhard/lists"}