Skip to content
Snippets Groups Projects

Resolve "Trying to access QM / Syncing Keys with Peer should not fully timeout after x attempts"

1 file
+ 2
11
Compare changes
  • Side-by-side
  • Inline
@@ -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
}
}
}
Loading