Skip to content

Commit

Permalink
store/copr: remove useless ticker for performance (#57558)
Browse files Browse the repository at this point in the history
ref #57580
  • Loading branch information
crazycs520 authored Nov 21, 2024
1 parent 9ae814b commit f347b9d
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions pkg/store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,8 +946,6 @@ func (sender *copIteratorTaskSender) run(connID uint64, checker resourcegroup.Ru

func (it *copIterator) recvFromRespCh(ctx context.Context, respCh <-chan *copResponse) (resp *copResponse, ok bool, exit bool) {
failpoint.InjectCall("CtxCancelBeforeReceive", ctx)
ticker := time.NewTicker(3 * time.Second)
defer ticker.Stop()
for {
select {
case resp, ok = <-respCh:
Expand All @@ -966,17 +964,6 @@ func (it *copIterator) recvFromRespCh(ctx context.Context, respCh <-chan *copRes
case <-it.finishCh:
exit = true
return
case <-ticker.C:
killed := atomic.LoadUint32(it.vars.Killed)
if killed != 0 {
logutil.Logger(ctx).Info(
"a killed signal is received",
zap.Uint32("signal", killed),
)
resp = &copResponse{err: derr.ErrQueryInterrupted}
ok = true
return
}
case <-ctx.Done():
// We select the ctx.Done() in the thread of `Next` instead of in the worker to avoid the cost of `WithCancel`.
if atomic.CompareAndSwapUint32(&it.closed, 0, 1) {
Expand Down

0 comments on commit f347b9d

Please sign in to comment.