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

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

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