You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ctx, cancel :=context.WithCancel(context.Background())
// Cancel 5 seconds in.
go func() {
time.Sleep(time.Second *5)
cancel()
}()
// This query should take 10 seconds to return.
rows, err :=dbt.db.QueryContext(ctx, "SELECT v, SLEEP(10) FROM test LIMIT 1")
fmt.Println(rows, err)
After reading #496 and #608, I was under the impression that in the above example, the underlying query would get canceled mid-execution, but that doesn't seem to be the case. It still takes 10 seconds to return (and the query shows in MySQL process list), albeit with the error sql: Rows are closed. Does this mean that the driver isn't actually able to cancel the underlying query running on the server?