Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
Added retry delay to registration loops
Browse files Browse the repository at this point in the history
We added retry delay to loops where it's possible to continue the loop
execution in case of an error. The solution is similiar to the one we added
in #409. If loop execution gets an error for any reason, e.g. problems
with connection to the ethereum API the client ended up in a crazy loop
logging huge amount of errors. This causes disk space drain by the log
file.
  • Loading branch information
nkuba committed May 20, 2020
1 parent 59dd98c commit 4cf63d2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/client/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package client
import (
"context"
"fmt"
"time"

"github.com/ethereum/go-ethereum/common"
eth "github.com/keep-network/keep-ecdsa/pkg/chain"
)

const statusCheckIntervalBlocks = 100
const retryDelay = 1 * time.Second

// checkStatusAndRegisterForApplication checks whether the operator is
// registered as a member candidate for keep for the given application.
Expand Down Expand Up @@ -37,6 +39,7 @@ RegistrationLoop:
application.String(),
err,
)
time.Sleep(retryDelay) // TODO: #413 Replace with backoff.
continue RegistrationLoop
}

Expand All @@ -51,6 +54,7 @@ RegistrationLoop:
// registered, we can start to monitor the status
if err := monitorSignerPoolStatus(ctx, ethereumChain, application); err != nil {
logger.Errorf("failed on signer pool status monitoring: [%v]", err)
time.Sleep(retryDelay) // TODO: #413 Replace with backoff.
continue RegistrationLoop
}
}
Expand Down Expand Up @@ -124,6 +128,7 @@ func registerAsMemberCandidateWhenEligible(
application.String(),
err,
)
time.Sleep(retryDelay) // TODO: #413 Replace with backoff.
continue
}

Expand All @@ -134,6 +139,7 @@ func registerAsMemberCandidateWhenEligible(
"operator is not eligible for application [%s]",
application.String(),
)
time.Sleep(retryDelay) // TODO: #413 Replace with backoff.
continue
}

Expand All @@ -149,6 +155,7 @@ func registerAsMemberCandidateWhenEligible(
application.String(),
err,
)
time.Sleep(retryDelay) // TODO: #413 Replace with backoff.
continue
}

Expand Down Expand Up @@ -180,6 +187,7 @@ func waitUntilRegistered(
application.String(),
err,
)
time.Sleep(retryDelay) // TODO: #413 Replace with backoff.
continue
}

Expand Down

0 comments on commit 4cf63d2

Please sign in to comment.