---
title: "Discussion on \"关于 Promise 的重试\" | Hashnode"
description: "Discussion on \"关于 Promise 的重试\". 这段时间经常用到重试功能，因为一些需求实现起来需要频繁访问接口，但这个接口不是我们自己的，服务器在海外，所以访问起来失败率肉眼可见地高，所以我需要在访问失败（因为连接原因）时自动进行重试。\n既然常用，那就把他记下来，方便下次查阅。\n实现\n先准备一个假的 fetch，在文章里面我不会真去访问这个接口，就拿假 fetch 来当例子：\nconst fetch = (url) => {\n  return new Promise((resolve, reject) => {\n    const r = M..."
url: "https://hashnode.com/posts/promise/6656dfed50a76e26839d6ef3"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [关于 Promise 的重试](https://erio.hashnode.dev/promise?utm_source=hashnode&utm_medium=feed)

这段时间经常用到重试功能，因为一些需求实现起来需要频繁访问接口，但这个接口不是我们自己的，服务器在海外，所以访问起来失败率肉眼可见地高，所以我需要在访问失败（因为连接原因）时自动进行重试。 既然常用，那就把他记下来，方便下次查阅。 实现 先准备一个假的 fetch，在文章里面我不会真去访问这个接口，就拿假 fetch 来当例子： const fetch = (url) => { return new Promise((resolve, reject) => { const r = M...

May 29, 2024 · 1 min read · erio.hashnode.dev  
Read the article

-   [#2articles1week](https://hashnode.com/tag/2articles1week)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#promise](https://hashnode.com/tag/promise)

## Written by

[Erioifpud](https://hashnode.com/@Erioifpud)

@Erioifpud

  
[View profile](https://hashnode.com/@Erioifpud)

Development

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
