Skip to content

Commit bcc247d

Browse files
author
James Cor
committed
actually use cancel context
1 parent 824fa1d commit bcc247d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

processlist.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ func (pl *ProcessList) BeginQuery(
135135
p.Query = query
136136
p.QueryPid = pid
137137
p.StartedAt = time.Now()
138-
p.Kill = cancel
138+
p.Kill = func(){
139+
print("KILL QUERY!!!\n")
140+
cancel()
141+
}
139142
p.Progress = make(map[string]sql.TableProgress)
140143

141144
pl.byQueryPid[ctx.Pid()] = ctx.Session.ID()

server/handler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,14 +415,14 @@ func (h *Handler) doQuery(
415415

416416
sqlCtx.GetLogger().Tracef("beginning execution")
417417

418-
oCtx := ctx
418+
//oCtx := ctx
419419

420420
// TODO: it would be nice to put this logic in the engine, not the handler, but we don't want the process to be
421421
// marked done until we're done spooling rows over the wire
422-
ctx, err = sqlCtx.ProcessList.BeginQuery(sqlCtx, query)
422+
sqlCtx, err = sqlCtx.ProcessList.BeginQuery(sqlCtx, query)
423423
defer func() {
424424
if err != nil && ctx != nil {
425-
sqlCtx.ProcessList.EndQuery(sqlCtx)
425+
sqlCtx.ProcessList.EndQuery(sqlCtx) // TODO: should this be ctx?
426426
}
427427
}()
428428

@@ -456,7 +456,7 @@ func (h *Handler) doQuery(
456456
}
457457

458458
// errGroup context is now canceled
459-
ctx = oCtx
459+
//ctx = oCtx
460460

461461
if err = setConnStatusFlags(sqlCtx, c); err != nil {
462462
return remainder, err

0 commit comments

Comments
 (0)