{"id":21901859,"url":"https://github.com/somebadcode/backoff","last_synced_at":"2025-07-14T09:37:03.885Z","repository":{"id":229710739,"uuid":"777148984","full_name":"somebadcode/backoff","owner":"somebadcode","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-18T16:03:18.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T06:18:51.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/somebadcode.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-25T09:51:19.000Z","updated_at":"2024-05-18T16:03:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"0812fb08-bde2-4d80-88dd-211817bbd110","html_url":"https://github.com/somebadcode/backoff","commit_stats":null,"previous_names":["somebadcode/backoff"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/somebadcode/backoff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somebadcode%2Fbackoff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somebadcode%2Fbackoff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somebadcode%2Fbackoff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somebadcode%2Fbackoff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/somebadcode","download_url":"https://codeload.github.com/somebadcode/backoff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/somebadcode%2Fbackoff/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262136997,"owners_count":23264671,"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":"2024-11-28T15:15:19.389Z","updated_at":"2025-06-26T20:03:48.733Z","avatar_url":"https://github.com/somebadcode.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backoff\n\nThis package implements concurrency safe and reusable backoff algorithms. All the algorithms will have the optional\njitter applied after the delay has been calculated.\n\nConcurrency safety relies on the struct fields not being changed when they might be in use. Once set, the code will not\nmake any changes to the fields.\n\n## Algorithms\n\n| Algorithm   | Formula           | Description                                                                                                                                  |\n|-------------|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| Constant    | `x(n) = b`        | Causes a constant delay between each adverse event.                                                                                          |\n| Linear      | `x(n) = b × a`    | Causes a linearly increasing backoff delay that scales with the number of adverse events.                                                    |\n| Exponential | `x(n) = b × fⁿ⁻¹` | Causes an exponentially increasing backoff delay that scales with the number of adverse events and the factor (`f`) of at least 2 or higher. |\n\nThe optional jitter (`j`) is added to the delay returned by the algorithms. A constant delay with jitter can be\nexpressed as `x(n) = n ± j`.\n\n## What is it for?\n\nBackoff algorithms are used to add a delay between attempts of an operation that can fail but can be repeated.\nAn example is connecting to a database where one failed attempt should not cause the application to just exit. Repeating\nattempts should not be done at the highest possible speed that an application can do it since it would just cause\nunnecessary CPU usage and network traffic that can raise alarms in firewalls.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsomebadcode%2Fbackoff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsomebadcode%2Fbackoff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsomebadcode%2Fbackoff/lists"}