Skip to content

Commit

Permalink
slow_query: cancel send taskList if ctx is done (#27471)
Browse files Browse the repository at this point in the history
* slow_query: cancel send taskList if ctx is done

Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun authored Aug 23, 2021
1 parent f36f78f commit 529fc03
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion executor/slow_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,11 @@ func (e *slowQueryRetriever) parseSlowLog(ctx context.Context, sctx sessionctx.C
if err != nil {
t := slowLogTask{}
t.resultCh = make(chan parsedSlowLog, 1)
e.taskList <- t
select {
case <-ctx.Done():
return
case e.taskList <- t:
}
e.sendParsedSlowLogCh(ctx, t, parsedSlowLog{nil, err})
}
if len(logs) == 0 || len(logs[0]) == 0 {
Expand Down

0 comments on commit 529fc03

Please sign in to comment.