From 0a501dee813508f6c497c44d603affb7611eef64 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 7 Feb 2024 19:44:28 +0300 Subject: [PATCH] [#968] adm: Allow concurrent epoch ticks Previous fix was incomplete, there are two possible places for this error to occur. Refs #592 Signed-off-by: Evgenii Stratonikov --- cmd/frostfs-adm/internal/modules/morph/epoch.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/epoch.go b/cmd/frostfs-adm/internal/modules/morph/epoch.go index 39dbb0caf..e491e8b8f 100644 --- a/cmd/frostfs-adm/internal/modules/morph/epoch.go +++ b/cmd/frostfs-adm/internal/modules/morph/epoch.go @@ -37,18 +37,14 @@ func forceNewEpochCmd(cmd *cobra.Command, _ []string) error { return err } - if err := wCtx.sendConsensusTx(bw.Bytes()); err != nil { - return err + if err = wCtx.sendConsensusTx(bw.Bytes()); err == nil { + err = 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 + if err != nil && strings.Contains(err.Error(), "invalid epoch") { + cmd.Println("Epoch has already ticked.") + return nil } - return nil + return err } func emitNewEpochCall(bw *io.BufBinWriter, wCtx *initializeContext, nmHash util.Uint160) error {