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
Add Backoff Utilities #833
Conversation
4479130
to
db053c7
Compare
src/utils/src/Backoff.php
Outdated
usleep($sleep * 1000); | ||
//update backoff using Decorrelated Jitter | ||
//see: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ | ||
$sleep = rand($firstMs, $sleep * 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
每次重试都是上次重试时间的 1-3倍,是这样么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不是 是第一次重试和上一次重试3倍之间的一个随机数,具体算法是https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter 这里提出的Decorrelated Jitter
最后还是选择了OOP而不是闭包,便于依赖注入 |
@Reasno 还有其他要补充的么?我觉得 OK 的。 |
没有了 想把重启进程改成backoff的,另开PR吧。 |
进程重启要不就不要改了吧。。因为按照现在的逻辑,假设出现问题。。 那就需要 1min 后才能重启,就算服务正常了。。 因为有一个常规重启逻辑,每当执行完多少次会重启的逻辑。。 |
async-queue 有一个 消费多少个消息后自动重启的功能 |
A simple implementation of #824