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

限流器设置可能有误 #69

Open
fufuok opened this issue Feb 24, 2022 · 0 comments
Open

限流器设置可能有误 #69

fufuok opened this issue Feb 24, 2022 · 0 comments

Comments

@fufuok
Copy link

fufuok commented Feb 24, 2022

limiter := rate.NewLimiter(rate.Every(time.Second*1), configs.MaxRequestsPerSecond)

代码中固定了 每秒只产生 1 个令牌, 即当初始的 10000 个消费完成后, 就只能 1 秒 1 个请求了.

可以发起 20000 个请求测试一下.

另外, 建议最好放到配置文件里, 而不是常量配置.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant