-
Notifications
You must be signed in to change notification settings - Fork 17
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 request token sending counter #353
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #353 +/- ##
==========================================
- Coverage 80.50% 80.33% -0.18%
==========================================
Files 22 22
Lines 1611 1632 +21
==========================================
+ Hits 1297 1311 +14
- Misses 235 239 +4
- Partials 79 82 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
defer ticker.Stop() | ||
// The request should be sent immediately at 0 seconds | ||
// The request should be sent immediately at 0.5 seconds | ||
time.Sleep(time.Millisecond * 500) |
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.
这里吃掉 0.5s 是什么打算,这也让任务的总体发压时间减了 0.5
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.
这里没有吃掉0.5秒,是第0.5秒发第一轮,1.5发第二轮,2.5发第三轮,以此类推。以前是第0秒发一次轮,第1秒发第二轮,第2秒发第三轮。由于结束的定时器也是整秒进行结束的,所以会因为轻微误差导致多发一轮,所以改到0.5秒发
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.
比如我想发压5秒,之前的逻辑是0,1,2,3,4发送,现在改为0.5,1.5,2.5,3.5,4.5 发送的轮数是一样的,为了跟定时结束的定时器错开时间
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.
发压定时器
0秒------第1次
1秒------第2次
2秒------第3次
3秒------第4次
4秒------第5次
5秒------可能因为误差channel比结束定时器先发送了,导致多请求一轮
Signed-off-by: ii2day <ji.li@daocloud.io>
9b909f1
to
c8dc481
Compare
添加 发送 token 的计数器,避免多发送 token