From dd988a5912e8a6fff3fb3aeb23588e836f1b3fae Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 10 Aug 2023 15:03:16 +0300 Subject: [PATCH] [#592] adm: Allow to tick epoch concurrently Epoch can be ticked by IR in the background. Because the only usecase for this is to apply some changes, the right behaviour is ignoring an error, not retrying. Signed-off-by: Evgenii Stratonikov --- cmd/frostfs-adm/internal/modules/morph/epoch.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/epoch.go b/cmd/frostfs-adm/internal/modules/morph/epoch.go index 1f622fa89..a96efa43f 100644 --- a/cmd/frostfs-adm/internal/modules/morph/epoch.go +++ b/cmd/frostfs-adm/internal/modules/morph/epoch.go @@ -3,6 +3,7 @@ package morph import ( "errors" "fmt" + "strings" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap" @@ -38,7 +39,14 @@ func forceNewEpochCmd(cmd *cobra.Command, _ []string) error { return err } - return wCtx.awaitTx() + if err := wCtx.awaitTx(); err != nil { + if strings.Contains(err.Error(), "invalid epoch") { + cmd.Println("Epoch has already ticked.") + return nil + } + return err + } + return nil } func emitNewEpochCall(bw *io.BufBinWriter, wCtx *initializeContext, nmHash util.Uint160) error {