Skip to content

Commit

Permalink
etcd_worker: set rate limit burst to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
asddongmen authored and ti-chi-bot committed Nov 4, 2021
1 parent c0c9ccb commit f947a4c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/orchestrator/etcd_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (worker *EtcdWorker) Run(ctx context.Context, session *concurrency.Session,
// tickRate represents the number of times EtcdWorker can tick
// the reactor per second
tickRate := time.Second / timerInterval
rl := rate.NewLimiter(rate.Limit(tickRate), int(tickRate)*3)
rl := rate.NewLimiter(rate.Limit(tickRate), 1)
for {
var response clientv3.WatchResponse
select {
Expand Down Expand Up @@ -189,8 +189,10 @@ func (worker *EtcdWorker) Run(ctx context.Context, session *concurrency.Session,
return errors.Trace(err)
}

// if !rl.Allow(), skip this Tick to avoid etcd worker tick reactor too frequency
// It make etcdWorker to batch etcd changed event in worker.state
// If !rl.Allow(), skip this Tick to avoid etcd worker tick reactor too frequency.
// It make etcdWorker to batch etcd changed event in worker.state.
// The semantics of `ReactorState` requires that any implementation
// can batch updates internally.
if !rl.Allow() {
continue
}
Expand Down

0 comments on commit f947a4c

Please sign in to comment.