{"id":15676520,"url":"https://github.com/adrai/tolerance","last_synced_at":"2025-07-08T04:07:53.373Z","repository":{"id":11295599,"uuid":"13709144","full_name":"adrai/tolerance","owner":"adrai","description":"This module wraps a function with retry functionality by passing a timeout. So the function will be more tolerant.","archived":false,"fork":false,"pushed_at":"2020-04-21T16:34:53.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-14T05:08:44.811Z","etag":null,"topics":["javascript","timeout","tolerance"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/adrai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["adrai"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2013-10-19T21:30:38.000Z","updated_at":"2022-03-08T11:03:37.000Z","dependencies_parsed_at":"2022-09-08T21:10:33.443Z","dependency_job_id":null,"html_url":"https://github.com/adrai/tolerance","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/adrai/tolerance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrai%2Ftolerance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrai%2Ftolerance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrai%2Ftolerance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrai%2Ftolerance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrai","download_url":"https://codeload.github.com/adrai/tolerance/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrai%2Ftolerance/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264192330,"owners_count":23570762,"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":["javascript","timeout","tolerance"],"created_at":"2024-10-03T16:02:56.232Z","updated_at":"2025-07-08T04:07:53.347Z","avatar_url":"https://github.com/adrai.png","language":"JavaScript","funding_links":["https://github.com/sponsors/adrai"],"categories":[],"sub_categories":[],"readme":"**The world needs more TOLERANCE!!!**\n\n# Introduction\n\n[![Build Status](https://secure.travis-ci.org/adrai/tolerance.png)](http://travis-ci.org/adrai/tolerance)\n[![Actions](https://github.com/adrai/tolerance/workflows/node/badge.svg)](https://github.com/adrai/tolerance/actions?query=workflow%3Anode)\n\nTolerance is a node.js module that wraps a function with retry functionality by passing a timeout. So the function will be more tolerant.\n\nYou can use it for example if you want to connect to a database that is not running immediately...\n\n# Installation\n\n    $ npm install tolerance\n\n# Usage\n\n\tvar tolerate = require('tolerance');\n\n\ttolerate(\n\t\tfunction(callback) {\n\t\t\tdb.connect(callback);\n\t\t},\n\t\t1500,\n\t\tfunction(err, res) {\n\t\t\t// If the db comes up after 800 ms\n\t\t\t// this callback will be called as the connection\n\t\t\t// would have been established immediately.\n\t\t\t//\n\t\t\t// If the db does not come up within the 1500 ms\n\t\t\t// this callback will be called with the appropriate error.\n\t\t\t//\n\t\t\t// In the background 'tolerance' will retry to connect to the db.\n\t\t}\n\t);\n\n\n## Use own retry indication\n\n\tvar tolerate = require('tolerance');\n\n\ttolerate(\n\t\tfunction(callback) {\n\t\t\tdb.connect(callback);\n\t\t},\n\t\t1500,\n\t\tfunction(err) { // should return true if you want to trigger a retry...\n\t\t\tif (err === 'not reached') {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tfunction(err, res) {\n\t\t\t// If the db comes up after 800 ms\n\t\t\t// this callback will be called as the connection\n\t\t\t// would have been established immediately.\n\t\t\t//\n\t\t\t// If the db does not come up within the 1500 ms\n\t\t\t// this callback will be called with the appropriate error.\n\t\t\t//\n\t\t\t// In the background 'tolerance' will retry to connect to the db.\n\t\t}\n\t);\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrai%2Ftolerance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrai%2Ftolerance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrai%2Ftolerance/lists"}