@@ -320,14 +320,6 @@ func FetchRemoteList(
320
320
}
321
321
err := refreshRemoteList (gl , remotes , maxNumSrcTCPPorts , minBatchInterval , HTTPResponseHeaderTimeout ,
322
322
orchestratorRESTConf , kill , logger )
323
- // Do not proceed until we have attempted to download the config file at least once
324
-
325
- if err != nil && len (gl .Remotes ) != 0 {
326
- logger .Debug ("Previously fetched target list will be re-used" )
327
- return nil
328
-
329
- }
330
- gl .Remotes = remotes
331
323
return err
332
324
}
333
325
@@ -388,23 +380,31 @@ func refreshRemoteList(
388
380
err = readRemoteList (raw , gl .RemoteConfig , remotes , maxNumSrcTCPPorts ,
389
381
minBatchInterval , logger )
390
382
if err != nil {
391
- logger .Error ("error parsing downloaded YAML configuration file" ,
383
+ logger .Error ("error parsing downloaded configuration file" ,
392
384
zap .Error (err ))
393
- goto cont
385
+ goto contError
394
386
}
387
+ gl .Remotes = remotes
395
388
logger .Info ("Will poll Orchestrator again later" ,
396
389
zap .String ("retry_time" ,
397
390
gl .RemoteConfig .PollOrchestratorInterval .Success .String ()))
398
391
return nil
399
392
400
393
case http .StatusNotFound :
401
394
retryTime = gl .RemoteConfig .PollOrchestratorInterval .Success
402
- goto cont
395
+ goto stayIdle
403
396
}
404
397
}
405
398
logger .Info ("Failed to download configuration file" , zap .Error (err ))
406
399
407
- cont:
400
+ contError:
401
+ if len (gl .Remotes ) != 0 {
402
+ logger .Debug ("last successfully fetched target list will be re-used" )
403
+ return nil
404
+
405
+ }
406
+ stayIdle:
407
+ // Do not proceed until we have attempted to download the config file at least once.
408
408
logger .Info ("Retrying configuration download" , zap .String ("retry_time" , retryTime .String ()))
409
409
confRetry := time .NewTicker (retryTime )
410
410
0 commit comments