{"id":16475943,"url":"https://github.com/softprops/again","last_synced_at":"2025-04-05T23:11:23.102Z","repository":{"id":46117689,"uuid":"262722326","full_name":"softprops/again","owner":"softprops","description":"♻️ Retry faillible Rustlang std library futures","archived":false,"fork":false,"pushed_at":"2024-07-29T20:41:02.000Z","size":816,"stargazers_count":58,"open_issues_count":6,"forks_count":17,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-17T11:59:47.190Z","etag":null,"topics":["futures","retry","wasm"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/softprops.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-05-10T05:56:51.000Z","updated_at":"2025-02-22T13:44:55.000Z","dependencies_parsed_at":"2024-10-11T12:40:58.894Z","dependency_job_id":null,"html_url":"https://github.com/softprops/again","commit_stats":{"total_commits":40,"total_committers":6,"mean_commits":6.666666666666667,"dds":"0.17500000000000004","last_synced_commit":"6db8c5e56bf93b1177ed35a926f8ff7d4adbf93b"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fagain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fagain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fagain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fagain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softprops","download_url":"https://codeload.github.com/softprops/again/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411236,"owners_count":20934653,"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":["futures","retry","wasm"],"created_at":"2024-10-11T12:40:55.971Z","updated_at":"2025-04-05T23:11:23.078Z","avatar_url":"https://github.com/softprops.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  again ♻️\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n   wasm-compatible retry interfaces for fallible Rustlang std library Futures\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/softprops/again/actions\"\u003e\n\t\t\u003cimg src=\"https://github.com/softprops/again/workflows/Main/badge.svg\"/\u003e\n\t\u003c/a\u003e\n  \u003ca href=\"https://crates.io/crates/again\"\u003e\n\t\t\u003cimg src=\"http://meritbadge.herokuapp.com/again\"/\u003e\n\t\u003c/a\u003e\n  \u003ca href=\"http://docs.rs/again\"\u003e\n\t\t\u003cimg src=\"https://docs.rs/again/badge.svg\"/\u003e\n\t\u003c/a\u003e  \n  \u003ca href=\"https://softprops.github.io/again\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/badge/docs-master-green.svg\"/\u003e\n\t\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\nA goal of any operation should be a successful outcome. This crate gives operations a better chance at achieving that.\n\n## 📦 install\n\nIn your Cargo.toml file, add the following under the `[dependencies]` heading\n\n```toml\nagain = \"0.1\"\n```\n\n## 🤸usage\n\nFor very simple cases you can use the module level `retry` function\nto retry a potentially fallible operation.\n\n```rust\nuse std::error::Error;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    pretty_env_logger::init();\n    again::retry(|| reqwest::get(\"https://api.you.com\")).await?;\n    Ok(())\n}\n```\n\nYou may not want to retry _every_ kind of error. For preciseness you can be more explicit in which kinds of errors should be retried with the module level `retry_if` function.\n\n```rust\nuse std::error::Error;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    pretty_env_logger::init();\n    again::retry_if(\n      || reqwest::get(\"https://api.you.com\")\n      reqwest::Error::is_status\n    ).await?;\n    Ok(())\n}\n```\n\nYou can also customize retry behavior to suit your applications needs\nwith a configurable and reusable `RetryPolicy`.\n\n```rust\nuse std::error::Error;\nuse std::time::Duration;\nuse again::RetryPolicy;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    pretty_env_logger::init();\n    let policy = RetryPolicy::exponential(Duration::from_millis(200))\n      .with_max_retries(10)\n      .with_jitter(true);\n    policy.retry(|| reqwest::get(\"https://api.you.com\")).await?;\n    Ok(())\n}\n```\n\nSee the [docs](http://docs.rs/again) for more examples.\n\nDoug Tangren (softprops) 2020\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Fagain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftprops%2Fagain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Fagain/lists"}