{"id":19621314,"url":"https://github.com/commenthol/fetchover","last_synced_at":"2026-02-01T06:32:43.385Z","repository":{"id":245662035,"uuid":"818910183","full_name":"commenthol/fetchover","owner":"commenthol","description":"A fetch implementation with failover","archived":false,"fork":false,"pushed_at":"2024-06-23T08:32:16.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-29T23:27:21.269Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commenthol.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,"zenodo":null}},"created_at":"2024-06-23T08:23:20.000Z","updated_at":"2024-06-23T08:32:19.000Z","dependencies_parsed_at":"2024-06-23T08:30:18.277Z","dependency_job_id":"72fafb19-f757-474d-bc7f-111751e47ce6","html_url":"https://github.com/commenthol/fetchover","commit_stats":null,"previous_names":["commenthol/fetchover"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/commenthol/fetchover","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Ffetchover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Ffetchover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Ffetchover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Ffetchover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commenthol","download_url":"https://codeload.github.com/commenthol/fetchover/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Ffetchover/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28970556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T05:48:53.985Z","status":"ssl_error","status_checked_at":"2026-02-01T05:47:55.855Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2024-11-11T11:22:19.746Z","updated_at":"2026-02-01T06:32:43.369Z","avatar_url":"https://github.com/commenthol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fetchover\n\nA fetch implementation with extensible failover strategies.\n\nSupports node and browsers.\n\n## Usage\n\n```js\nimport { fetchOver, SimpleFailover } from 'fetchover'\n\n// define your failover servers\nconst servers = [\n  'https://fallback1.server',\n  'https://fallback2.server'\n]\n// choose a failover implemention (or create your own)\nconst failover = new SimpleFailover({ servers, timeout: 5e3 })\nconst fetch = fetchOver({ failover, strategy: 'sequential' })\n\n// just fetch as always (with optional timeout)\nconst res = await fetch('https://target.server', { timeout: 10e3 })\n```\n\nDifferent strategies are available.\n- `strategy='sequential'` (default) the \"fallback\" servers are called one after\n  another in sequence.  \n- `strategy='random'` is similar but the order of \"fallback\" servers being\n  called is random.  \n- `strategy='parallel'` all servers are called in parallel. The response of the\n  first to succeed is returned, the other requests are aborted.  \n  ⚠️ *Note: Take care to cope with multiple writes, e.g. using*\n  *optimistic-locking in your DB.*\n\n# Failover\n\nFor customizing the behavior of the failover scenarios different `failover`\nadapters are offered.\n\n## SimpleFailover\n\nThe `SimpleFailover` mechanism will issue the request (using the same pathname\nbut different hostname) to different \"fallback\" servers in case that the\n\"target\" server of the initial request is unavailable.\n\nWith `timeout` you can control when the next request after a failure can be\nissued, effectively acting as circuit breaker here. Default is 5 seconds.\n\nIn case that only the circuit breaker functionality is needed, don't name any\nfallback servers.\n\n*type declaration*\n\n```ts\ninterface SimpleFailoverOptions {\n  /** list of failover servers */\n  servers?: string[]\n  /**\n   * timeout of consecutive request after failure (circuit breaker)\n   * @default 5e3\n   */\n  timeout?: number\n}\n\nclass SimpleFailover implements Failover {\n    constructor(param: SimpleFailoverOptions);\n}\n```\n\n## License\n\n[MIT Licensed](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Ffetchover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommenthol%2Ffetchover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Ffetchover/lists"}