{"id":16930237,"url":"https://github.com/alexpantyukhin/retryer","last_synced_at":"2025-06-29T18:36:23.395Z","repository":{"id":77360847,"uuid":"214149529","full_name":"alexpantyukhin/retryer","owner":"alexpantyukhin","description":null,"archived":false,"fork":false,"pushed_at":"2019-10-16T06:22:48.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T04:41:26.482Z","etag":null,"topics":["go","golang","golang-library","retry","retry-library","retry-pattern","retrying"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexpantyukhin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-10-10T10:06:54.000Z","updated_at":"2022-02-07T05:08:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"f0b5f793-3969-4668-a55f-a49f85b8d52b","html_url":"https://github.com/alexpantyukhin/retryer","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/alexpantyukhin%2Fretryer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpantyukhin%2Fretryer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpantyukhin%2Fretryer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpantyukhin%2Fretryer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexpantyukhin","download_url":"https://codeload.github.com/alexpantyukhin/retryer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244759962,"owners_count":20505716,"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","golang-library","retry","retry-library","retry-pattern","retrying"],"created_at":"2024-10-13T20:41:13.358Z","updated_at":"2025-03-21T08:11:58.185Z","avatar_url":"https://github.com/alexpantyukhin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Retryer\r\n\r\n[![Build Status](https://travis-ci.org/alexpantyukhin/retryer.svg?branch=master\r\n)](https://travis-ci.org/alexpantyukhin/retryer)\r\n[![GoDoc](https://godoc.org/alexpantyukhin/retryer?status.svg)](https://godoc.org/github.com/alexpantyukhin/retryer)\r\n\r\nThe tiny library for retrying any action.\r\n\r\n# Motivation\r\n\r\nI needed in some similar behavior in the one of project. A half of a minute of googling showed nothing. That's why the decision to extract the library was made.\r\n\r\n# Plans\r\n   - [ ] Add cancellation context.\r\n\r\n# Usages\r\n\r\n## Retry number of times\r\n\r\n```go\r\nRetry(10).\r\n    ExecuteBool(func() bool {\r\n        counter++\r\n\r\n        if counter == 5 {\r\n            return true\r\n        }\r\n\r\n        return false\r\n    })\r\n```\r\n\r\n## Retry with error\r\n\r\n```go\r\nRetry(10).\r\n    ExecuteError(func() error {\r\n        conn, err := MakeConnection()\r\n\r\n        return err\r\n    })\r\n```\r\n\r\n## Retry with wait\r\n\r\n```go\r\nRetryAndWait([]time.Duration{1000 * time.Millisecond, 1000 * time.Millisecond}).\r\n    ExecuteError(func() error {\r\n        conn, err := MakeConnection()\r\n\r\n        return err\r\n    })\r\n```\r\n\r\n## retry with wait forever\r\n\r\n```go\r\nRetryAndWaitForever(func(attempt int) time.Duration { return time.Duration(attempt*100) * time.Millisecond }).\r\n    ExecuteError(func() error {\r\n        conn, err := MakeConnection()\r\n\r\n        return err\r\n    })\r\n```\r\n\r\n# Installation\r\nJust go get this repository with the following way:\r\n\r\n```\r\ngo get github.com/alexpantyukhin/retryer\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpantyukhin%2Fretryer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexpantyukhin%2Fretryer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpantyukhin%2Fretryer/lists"}