mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
debugd: return download error if download is not attempted due to retry backoff
This commit is contained in:
parent
995f2f6270
commit
7143b29caf
@ -37,7 +37,7 @@ func (d *Download) DownloadCoordinator(ctx context.Context, ip string) error {
|
|||||||
serverAddr := net.JoinHostPort(ip, debugd.DebugdPort)
|
serverAddr := net.JoinHostPort(ip, debugd.DebugdPort)
|
||||||
// only retry download from same endpoint after backoff
|
// only retry download from same endpoint after backoff
|
||||||
if lastAttempt, ok := d.attemptedDownloads[serverAddr]; ok && time.Since(lastAttempt) < debugd.CoordinatorDownloadRetryBackoff {
|
if lastAttempt, ok := d.attemptedDownloads[serverAddr]; ok && time.Since(lastAttempt) < debugd.CoordinatorDownloadRetryBackoff {
|
||||||
return nil
|
return fmt.Errorf("download failed too recently: %v / %v", time.Since(lastAttempt), debugd.CoordinatorDownloadRetryBackoff)
|
||||||
}
|
}
|
||||||
log.Printf("Trying to download coordinator from %s\n", ip)
|
log.Printf("Trying to download coordinator from %s\n", ip)
|
||||||
d.attemptedDownloads[serverAddr] = time.Now()
|
d.attemptedDownloads[serverAddr] = time.Now()
|
||||||
|
@ -52,10 +52,7 @@ func TestDownloadCoordinator(t *testing.T) {
|
|||||||
attemptedDownloads: map[string]time.Time{
|
attemptedDownloads: map[string]time.Time{
|
||||||
"192.0.2.0:4000": time.Now(),
|
"192.0.2.0:4000": time.Now(),
|
||||||
},
|
},
|
||||||
expectDownloadErr: false,
|
expectDownloadErr: true,
|
||||||
expectFile: false,
|
|
||||||
expectSystemdAction: false,
|
|
||||||
expectDeployed: false,
|
|
||||||
},
|
},
|
||||||
"download rpc call error is detected": {
|
"download rpc call error is detected": {
|
||||||
server: fakeOnlyDownloadServer{
|
server: fakeOnlyDownloadServer{
|
||||||
|
Loading…
Reference in New Issue
Block a user