{"id":13764077,"url":"https://github.com/shafreeck/retry","last_synced_at":"2025-04-05T04:31:36.245Z","repository":{"id":57483124,"uuid":"141415114","full_name":"shafreeck/retry","owner":"shafreeck","description":"A pretty simple library to ensure your work to be done","archived":false,"fork":false,"pushed_at":"2020-02-11T03:47:03.000Z","size":18,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T22:23:04.144Z","etag":null,"topics":["go","golang","retry","retry-library","retrying","timeout"],"latest_commit_sha":null,"homepage":"","language":"Go","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/shafreeck.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}},"created_at":"2018-07-18T09:48:33.000Z","updated_at":"2023-11-06T20:19:22.000Z","dependencies_parsed_at":"2022-08-27T21:02:22.350Z","dependency_job_id":null,"html_url":"https://github.com/shafreeck/retry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafreeck%2Fretry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafreeck%2Fretry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafreeck%2Fretry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafreeck%2Fretry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shafreeck","download_url":"https://codeload.github.com/shafreeck/retry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289382,"owners_count":20914463,"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":["go","golang","retry","retry-library","retrying","timeout"],"created_at":"2024-08-03T15:01:12.243Z","updated_at":"2025-04-05T04:31:31.223Z","avatar_url":"https://github.com/shafreeck.png","language":"Go","funding_links":[],"categories":["Utilities","公用事业公司","工具库`可以提升效率的通用代码库和工具`","工具库","Utility"],"sub_categories":["Utility/Miscellaneous","实用程序/Miscellaneous","HTTP Clients","Fail injection","查询语","交流"],"readme":"Retry is a pretty simple library to ensure your work to be done\n\n[godoc](https://godoc.org/github.com/shafreeck/retry)\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/shafreeck/retry)](https://goreportcard.com/report/github.com/shafreeck/retry)\n[![cover.run](https://cover.run/go/github.com/shafreeck/retry.svg?style=flat\u0026tag=golang-1.9)](https://cover.run/go?tag=golang-1.9\u0026repo=github.com%2Fshafreeck%2Fretry)\n\n## Features\n* Retry to run a workflow(Ex. rpc or db access)\n* Customize backoff strategy\n* Retry accoding to your type of error\n\n## Examples\n\n```go\nfunc ExampleEnsure() {\n    r := New()\n    ctx, cancel := context.WithTimeout(context.Background(), time.Second)\n    defer cancel()\n\n    err := r.Ensure(ctx, func() error {\n        resp, err := http.Get(\"http://www.example.com\")\n        // Get error can be retried\n        if err != nil {\n            log.Println(err)\n            return Retriable(err)\n        }\n        log.Println(resp)\n\n        buf := bytes.NewBuffer(nil)\n        resp, err = http.Post(\"http://example.com/upload\", \"image/jpeg\", buf)\n        // Post error should not be retried\n        if err != nil {\n            return err\n        }\n        log.Println(resp)\n        return nil\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshafreeck%2Fretry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshafreeck%2Fretry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshafreeck%2Fretry/lists"}