We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在 speed.go 这个文件中,定义了一个 Qos 结构用于限速。其中启动了一个定时器,每秒往一个 chan 中放 qps 个 token。因为第一次放 token 是在一秒之后,这导致对某个 db 执行 VerifyAllKeyInfo 之前需要等待 1 秒,这大大拖慢了 check 的速度。
qps
相关代码如下:
// limit qps qos := common.StartQoS(conf.Opts.Qps) for keyInfo := range allKeys { <-qos.Bucket p.verifier.VerifyOneGroupKeyInfo(keyInfo, conflictKey, &sourceClient, &targetClient) } // for oneGroupKeys := range allKeys func (q *Qos) timer() { for range time.NewTicker(1 * time.Second).C { if q.close { return } for i := 0; i < q.limit; i++ { select { case q.Bucket <- struct{}{}: default: // break if bucket if full break } } } }
我考虑可以在启动 timer 的时候,就立刻扔 q.limit 个 token 到 q.Bucket 中。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在 speed.go 这个文件中,定义了一个 Qos 结构用于限速。其中启动了一个定时器,每秒往一个 chan 中放
qps
个 token。因为第一次放 token 是在一秒之后,这导致对某个 db 执行 VerifyAllKeyInfo 之前需要等待 1 秒,这大大拖慢了 check 的速度。相关代码如下:
我考虑可以在启动 timer 的时候,就立刻扔 q.limit 个 token 到 q.Bucket 中。
The text was updated successfully, but these errors were encountered: