Skip to content

Commit e0546ae

Browse files
authored
fix: support ExecContext cancel query (#127)
* fix: support ExecContext cancel query * fix
1 parent 0e43f54 commit e0546ae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

restful.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,12 @@ func (c *APIClient) PollUntilQueryEnd(ctx context.Context, resp *QueryResponse)
377377
data := resp.Data
378378
resp, err = c.PollQuery(ctx, resp.NextURI)
379379
if err != nil {
380+
if errors.Is(err, context.Canceled) {
381+
// context might be canceled due to timeout or canceled. if it's canceled, we need call
382+
// the kill url to tell the backend it's killed.
383+
fmt.Printf("query canceled, kill query:%s", resp.ID)
384+
_ = c.KillQuery(context.Background(), resp)
385+
}
380386
return nil, err
381387
}
382388
if resp.Error != nil {

0 commit comments

Comments
 (0)