Retry Environment Recovery

This commit is contained in:
Maximilian Paß
2023-08-16 12:47:32 +02:00
committed by Sebastian Serth
parent 89c18ad45c
commit 73759f8a3c
6 changed files with 13 additions and 6 deletions

View File

@ -245,7 +245,7 @@ func (n *NomadEnvironment) Sample() (runner.Runner, bool) {
r, ok := n.idleRunners.Sample()
if ok && n.idleRunners.Length() < n.PrewarmingPoolSize() {
go func() {
err := util.RetryExponential(time.Second, func() error {
err := util.RetryExponential(func() error {
return n.createRunner(false)
})
if err != nil {

View File

@ -12,6 +12,7 @@ import (
"github.com/openHPI/poseidon/pkg/logging"
"github.com/openHPI/poseidon/pkg/monitoring"
"github.com/openHPI/poseidon/pkg/storage"
"github.com/openHPI/poseidon/pkg/util"
"os"
"time"
)
@ -42,7 +43,7 @@ func NewNomadEnvironmentManager(
m := &NomadEnvironmentManager{&AbstractManager{nil, runnerManager},
apiClient, templateEnvironmentJobHCL}
if err := m.Load(); err != nil {
if err := util.RetryExponential(func() error { return m.Load() }); err != nil {
log.WithError(err).Error("Error recovering the execution environments")
}
runnerManager.Load()