Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增强 retry() #4021

Merged
merged 5 commits into from
Sep 7, 2021
Merged

增强 retry() #4021

merged 5 commits into from
Sep 7, 2021

Conversation

huangdijia
Copy link
Member

@huangdijia huangdijia commented Sep 6, 2021

  • 增加 $attempts 至回调方法 $callback

- 增加 `$when` 参数,支持忽略异常
- 增加 `$attempts` 至回调方法 `$callback`
@limingxinleo
Copy link
Member

这个就不增加了。。写一个作为自己常用的函数吧

@limingxinleo
Copy link
Member

when 功能去掉吧,attempts 这个我觉得可以保留

@limingxinleo limingxinleo requested a review from Reasno September 6, 2021 09:26
@limingxinleo limingxinleo added the reviewing Reviewing a pull request label Sep 6, 2021
@huangdijia
Copy link
Member Author

when 功能去掉吧,attempts 这个我觉得可以保留

Copy link
Member

@limingxinleo limingxinleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attempts这个,应该是从0开始比较好,还是1开始?

@huangdijia
Copy link
Member Author

attempts这个,应该是从0开始比较好,还是1开始?

应该是从 1 开始,我理解的是执行次数,retry 进来就是 1 次了。

@limingxinleo
Copy link
Member

retry 1 实际上是会执行两次,代表重试1次

那attempts第二次,就会返回2?

我觉得是不是跟,retry的入参对应比较好,attempts 改成 retryCount ,然后从0开始记录?

这个让 @huangzhhui @Reasno 也看一下

@limingxinleo
Copy link
Member

不着急合并

@huangdijia
Copy link
Member Author

不着急合并

OK

@limingxinleo
Copy link
Member

当然,如果命名是attemps,那从1开始记录,还是挺合适的,我觉得都可以,让其他人也看一下吧 @huangdijia

@limingxinleo
Copy link
Member

使用 attempts

@limingxinleo
Copy link
Member

使用 retryCount

@limingxinleo
Copy link
Member

投个票

huangzhhui
huangzhhui previously approved these changes Sep 6, 2021
Copy link
Member

@huangzhhui huangzhhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

赞成 $attempts = 0

@limingxinleo
Copy link
Member

@huangzhhui 就是现在的模式么?

@limingxinleo limingxinleo merged commit 6ad5713 into hyperf:master Sep 7, 2021
@huangdijia huangdijia deleted the retry branch September 7, 2021 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reviewing Reviewing a pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants