File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ func (d *DataSetClient) doPingRequest(ctx context.Context, req interface{}) (*LR
105105 delay := 1 * time .Second
106106 const maxDelay = 8 * time .Second
107107
108- for i := 0 ; ; i ++ {
108+ loop: for i := 0 ; ; i ++ {
109109 resp , err := d .netClient .Do (request )
110110 if err != nil {
111111 if e , ok := err .(* url.Error ); ok && e .Timeout () {
@@ -133,22 +133,23 @@ func (d *DataSetClient) doPingRequest(ctx context.Context, req interface{}) (*LR
133133 return nil , err
134134 }
135135
136- if respBody .StepsCompleted >= respBody .StepsTotal {
137- break
138- }
139-
140136 // Only check for the token from the initial launch request
141137 if i == 0 {
142138 token = resp .Header .Get (TOKEN_HEADER )
143139 }
144140
141+ if respBody .StepsCompleted >= respBody .StepsTotal {
142+ break
143+ }
144+
145145 // Sleep but cancel if signaled by the Grafana server context.
146146 // Cancels occur when the user navigates aways from the page (via embedded Javascript), Grafana shutdown, etc.
147147 select {
148148 case <- ctx .Done ():
149149 err := ctx .Err ()
150150 log .DefaultLogger .Warn ("DataSet request canceled by Grafana" , "err" , err )
151- return nil , err
151+ // This is commonplace occurrence and should still send the delete to cleanup
152+ break loop
152153 case <- time .After (delay ):
153154 // No-op
154155 }
You can’t perform that action at this time.
0 commit comments