Skip to content

Commit 29842b8

Browse files
committed
retry ensureAccount only on ActivationServiceError
1 parent 88fae6c commit 29842b8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/substrate_gateway/substrate_gateway.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,13 @@ func (g *substrateGateway) EnsureAccount(activationURL []string, termsAndConditi
5858
g.mu.Lock()
5959
defer g.mu.Unlock()
6060
for _, url := range activationURL {
61-
if info, err = g.sub.EnsureAccount(g.identity, url, termsAndConditionsLink, termsAndConditionsHash); err == nil {
62-
return
61+
info, err = g.sub.EnsureAccount(g.identity, url, termsAndConditionsLink, termsAndConditionsHash)
62+
// check other activationURL only if EnsureAccount failed with ActivationServiceError
63+
if errors.Is(err, substrate.ActivationServiceError{}) {
64+
log.Debug().Str("activation url", url).Err(err).Msg("failed to EnsureAccount with ActivationServiceError")
65+
continue
6366
}
67+
return
6468
}
6569
return
6670
}

0 commit comments

Comments
 (0)