From 4c43f8ab33c49025607dc0b529413c4047a6f9cf Mon Sep 17 00:00:00 2001 From: bd21 Date: Tue, 21 Nov 2023 01:40:45 -0800 Subject: [PATCH] random sleep time hotfix --- cmd/noble/broadcast.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/noble/broadcast.go b/cmd/noble/broadcast.go index 14986ac..64c242d 100644 --- a/cmd/noble/broadcast.go +++ b/cmd/noble/broadcast.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "io" + "math/rand" "net/http" "regexp" "strconv" @@ -139,6 +140,8 @@ func Broadcast( // Log retry information logger.Info(fmt.Sprintf("Retrying in %d seconds", cfg.Networks.Destination.Noble.BroadcastRetryInterval)) time.Sleep(time.Duration(cfg.Networks.Destination.Noble.BroadcastRetryInterval) * time.Second) + // wait a random amount of time to lower probability of concurrent message nonce collision + time.Sleep(time.Duration(rand.Intn(5)) * time.Second) continue } @@ -155,6 +158,8 @@ func Broadcast( // Log retry information logger.Info(fmt.Sprintf("Retrying in %d seconds", cfg.Networks.Destination.Noble.BroadcastRetryInterval)) time.Sleep(time.Duration(cfg.Networks.Destination.Noble.BroadcastRetryInterval) * time.Second) + // wait a random amount of time to lower probability of concurrent message nonce collision + time.Sleep(time.Duration(rand.Intn(5)) * time.Second) continue }