{"id":16101718,"url":"https://github.com/kelunik/retry","last_synced_at":"2025-07-14T09:08:43.347Z","repository":{"id":57005472,"uuid":"104060458","full_name":"kelunik/retry","owner":"kelunik","description":"A tiny library for retrying failed operations.","archived":false,"fork":false,"pushed_at":"2018-12-24T20:43:18.000Z","size":8,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T13:23:30.059Z","etag":null,"topics":["amphp","backoff","reliability","retry"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/kelunik.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":"2017-09-19T10:22:03.000Z","updated_at":"2025-03-02T14:29:22.000Z","dependencies_parsed_at":"2022-08-21T12:40:30.215Z","dependency_job_id":null,"html_url":"https://github.com/kelunik/retry","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelunik%2Fretry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelunik%2Fretry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelunik%2Fretry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelunik%2Fretry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kelunik","download_url":"https://codeload.github.com/kelunik/retry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244078024,"owners_count":20394402,"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":["amphp","backoff","reliability","retry"],"created_at":"2024-10-09T18:50:47.483Z","updated_at":"2025-03-17T17:31:26.933Z","avatar_url":"https://github.com/kelunik.png","language":"PHP","funding_links":[],"categories":["Retrying"],"sub_categories":["Tunnel"],"readme":"# retry\n\n`kelunik/retry` is a small library for retrying failed operations.\n\n## Installation\n\n```plain\ncomposer require kelunik/retry\n```\n\n## Usage\n\n```php\n\u003c?php\n\nuse Amp\\Loop;\nuse Kelunik\\Retry\\ConstantBackoff;\nuse function Kelunik\\Retry\\retry;\n\nrequire __DIR__ . \"/../vendor/autoload.php\";\n\nLoop::run(function () {\n    /** @var Amp\\Socket\\ClientSocket $socket */\n    $socket = yield retry(3, function () {\n        return Amp\\Socket\\cryptoConnect(\"tcp://github.com:443\");\n    }, Amp\\Socket\\SocketException::class, new ConstantBackoff(1000));\n\n    yield $socket-\u003ewrite(\"GET / HTTP/1.0\\r\\nhost: github.com\\r\\n\\r\\n\");\n\n    $buffer = \"\";\n\n    while (null !== $chunk = yield $socket-\u003eread()) {\n        $buffer .= $chunk;\n\n        if (strpos($buffer, \"\\r\\n\\r\\n\") !== false) {\n            print strstr($buffer, \"\\r\\n\\r\\n\", true);\n            break;\n        }\n    }\n\n    $socket-\u003eclose();\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelunik%2Fretry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkelunik%2Fretry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelunik%2Fretry/lists"}