Skip to content
Snippets Groups Projects
Verified Commit c0cb9c1c authored by Malte Bauch's avatar Malte Bauch
Browse files

KeyFetching does not stop after set amount of failed retries

parent fbcd842a
No related branches found
No related tags found
1 merge request!200Resolve "Trying to access QM / Syncing Keys with Peer should not fully timeout after x attempts"
Pipeline #222207 passed
......@@ -113,17 +113,9 @@ func (qm *ETSI014HTTPQuantumModule) Initialize() error {
ticker := time.NewTicker(restartWaitingTime)
defer ticker.Stop()
restartedAfterWaitingTime := new(int)
// immediately start with the ticker instead of waiting the defined amount
for ; true; <-ticker.C {
if *restartedAfterWaitingTime == 5 {
log.Fatalf("Stopped retrying to fetch keys after %d attempts waiting %v each time in between.", restartedAfterWaitingTime, restartWaitingTime)
break
}
qm.doKeyFetching(restartedAfterWaitingTime)
*restartedAfterWaitingTime++
qm.doKeyFetching()
}
}()
}
......@@ -184,7 +176,7 @@ func (qm *ETSI014HTTPQuantumModule) GetKeyWithIds(keyIds []etsi14ClientGenerated
return container, nil
}
func (qm *ETSI014HTTPQuantumModule) doKeyFetching(restartedAfterWaitingTime *int) {
func (qm *ETSI014HTTPQuantumModule) doKeyFetching() {
ticker := time.NewTicker(time.Duration(qm.keyFetchInterval) * time.Second)
defer ticker.Stop()
......@@ -230,7 +222,6 @@ func (qm *ETSI014HTTPQuantumModule) doKeyFetching(restartedAfterWaitingTime *int
}
failedAttemps = 0
*restartedAfterWaitingTime = 0
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment