{"id":20048722,"url":"https://github.com/leaf4monkey-npm/retry","last_synced_at":"2025-03-02T08:23:23.738Z","repository":{"id":57331584,"uuid":"88723490","full_name":"leaf4monkey-npm/retry","owner":"leaf4monkey-npm","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-27T08:00:51.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T21:05:53.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/leaf4monkey-npm.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}},"created_at":"2017-04-19T08:58:12.000Z","updated_at":"2017-04-19T09:15:02.000Z","dependencies_parsed_at":"2022-09-01T15:30:49.110Z","dependency_job_id":null,"html_url":"https://github.com/leaf4monkey-npm/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/leaf4monkey-npm%2Fretry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaf4monkey-npm%2Fretry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaf4monkey-npm%2Fretry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaf4monkey-npm%2Fretry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leaf4monkey-npm","download_url":"https://codeload.github.com/leaf4monkey-npm/retry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241478265,"owners_count":19969258,"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-13T11:45:40.681Z","updated_at":"2025-03-02T08:23:23.697Z","avatar_url":"https://github.com/leaf4monkey-npm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# promised-simple-retry\n\n\n## Environment\n\nnode \u003e= 4.x\n\n\n## Installation\n\n```bash\nnpm install --save promised-simple-retry\n```\n\n\n## Usage\n\n```js\nconst retry = require('promised-simple-retry');\n\nlet task = function () {\n    // what you want to do.\n    throw new Error('always wrong.');\n};\n\nlet options = {\n    times: 3, // maximum retry times, default `3`\n    delay: 100, // delay milliseconds before execute `task()`, default `0`\n    delay1st: true, // delay the 1st execution, default `false`\n    timeout: 10 * 1000, // maximum execution milliseconds, default `0`\n    debug: false\n};\n\nretry(task, options).then(function (res) {\n    console.log('success');\n}).catch(function (err) {\n    console.log('failed');\n    console.log(`tried ${err.tried} times.`);\n    console.log(`cost ${err.cost} ms in total.`);\n});\n```\n\n\n## Test\n\n```bash\nnpm i -g mocha\nnpm run test\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleaf4monkey-npm%2Fretry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleaf4monkey-npm%2Fretry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleaf4monkey-npm%2Fretry/lists"}