{"id":41981711,"url":"https://github.com/asaf-shitrit/go-wait","last_synced_at":"2026-01-25T23:58:03.183Z","repository":{"id":45309897,"uuid":"436249349","full_name":"asaf-shitrit/go-wait","owner":"asaf-shitrit","description":"A tiny util for patient programs","archived":false,"fork":false,"pushed_at":"2021-12-22T10:48:18.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-19T20:50:54.426Z","etag":null,"topics":["backoff","golang","jitter","polling","tiny","util","wait"],"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/asaf-shitrit.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":"2021-12-08T13:01:46.000Z","updated_at":"2022-01-06T03:49:58.000Z","dependencies_parsed_at":"2022-09-07T15:41:19.004Z","dependency_job_id":null,"html_url":"https://github.com/asaf-shitrit/go-wait","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/asaf-shitrit/go-wait","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asaf-shitrit%2Fgo-wait","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asaf-shitrit%2Fgo-wait/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asaf-shitrit%2Fgo-wait/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asaf-shitrit%2Fgo-wait/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asaf-shitrit","download_url":"https://codeload.github.com/asaf-shitrit/go-wait/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asaf-shitrit%2Fgo-wait/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28761826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T23:06:19.311Z","status":"ssl_error","status_checked_at":"2026-01-25T23:03:50.555Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["backoff","golang","jitter","polling","tiny","util","wait"],"created_at":"2026-01-25T23:58:02.477Z","updated_at":"2026-01-25T23:58:03.178Z","avatar_url":"https://github.com/asaf-shitrit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-wait\n[![Tests](https://github.com/asaf-shitrit/go-wait/actions/workflows/run-tests.yml/badge.svg)](https://github.com/asaf-shitrit/go-wait/actions/workflows/run-tests.yml)\n\nA tiny util library for programs that require a little patience ⏰\n\n## Usage\n### Wait\nUseful for simple cases where a predictable `bool` check should be ran\nin a set interval and continue when it is satisfied.\n#### Basic usage\n```go\nimport (\n\twait \"github.com/asaf-shitrit/go-wait\"\n)\n\ncheckFunc := func() (bool, error) {\n    // any bool based logic that changes over a \n    // given period of time\n}\n\nctx := context.Background() // or pass any ctx you would like\nif err := wait.Until(ctx, checkFunc); err != nil {\n    // handle logical/timeout err\n}\n\n// logic that should happen after check is satisfied\n```\n#### With explicit options\n```go\nimport (\n\twait \"github.com/asaf-shitrit/go-wait\"\n)\n\ncheckFunc := func() (bool, error) {\n    // any bool based logic that changes over a \n    // given period of time\n}\n\noptions := \u0026wait.UntilOptions{\n    Timeout: time.Minute\n    Interval: time.Second\n}\n\nctx := context.Background() // or pass any ctx you would like\nif err := wait.Until(ctx, checkFunc, options); err != nil {\n    // handle logical/timeout err\n}\n\n// logic that should happen after check is satisfied\n```\n\n### Backoff\nReally useful in cases that low CPU overhead a constraint and the check intervals \nshould be backed off after each run.\n\nIt was inspired by Go's own `http.Server` `Shutdown` implementation ❤️\n\n#### Basic usage\n```go\nimport (\n\twait \"github.com/asaf-shitrit/go-wait\"\n)\n\ncheckFunc := func() (bool, error) {\n    // any bool based logic that changes over a \n    // given period of time\n}\n\nctx := context.Background() // or pass any ctx you would like\nif err := wait.Backoff(ctx, checkFunc); err != nil {\n    // handle logical/timeout err\n}\n\n// logic that should happen after check is satisfied\n```\n\n#### With explicit options\n```go\nimport (\n\twait \"github.com/asaf-shitrit/go-wait\"\n)\n\ncheckFunc := func() (bool, error) {\n    // any bool based logic that changes over a \n    // given period of time\n}\n\noptions := \u0026wait.BackoffOptions{\n\tBaselineDuration: time.Millisecond,\n\tLimit:            500 * time.Millisecond,\n\tMultiplier:       2,\n}\n\nctx := context.Background() // or pass any ctx you would like\nif err := wait.Backoff(ctx, checkFunc, options); err != nil {\n    // handle logical/timeout err\n}\n\n// logic that should happen after check is satisfied\n```\n\n### Capabilities\n### Timeout \u0026 Cancel ⏰\nIt is aligned with Golang concept of context so explicit cancels \u0026 timeout will work\nout of the box.\n#### Jitter\nAllows you to set an amount of jitter percentage that will apply\nfor the calculation of each interval.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasaf-shitrit%2Fgo-wait","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasaf-shitrit%2Fgo-wait","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasaf-shitrit%2Fgo-wait/lists"}