File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -194,7 +194,14 @@ func (st *stmt) watchCancel(ctx context.Context) func() {
194
194
go func () {
195
195
select {
196
196
case <- done :
197
- _ = st .cancel ()
197
+ // At this point the function level context is canceled,
198
+ // so it must not be used for the additional network
199
+ // request to cancel the query.
200
+ // Create a new context to pass into the dial.
201
+ ctxCancel , cancel := context .WithTimeout (context .Background (), time .Second * 10 )
202
+ defer cancel ()
203
+
204
+ _ = st .cancel (ctxCancel )
198
205
finished <- struct {}{}
199
206
case <- finished :
200
207
}
@@ -209,6 +216,6 @@ func (st *stmt) watchCancel(ctx context.Context) func() {
209
216
return nil
210
217
}
211
218
212
- func (st * stmt ) cancel () error {
213
- return st .cn .cancel ()
219
+ func (st * stmt ) cancel (ctx context. Context ) error {
220
+ return st .cn .cancel (ctx )
214
221
}
You can’t perform that action at this time.
0 commit comments