Skip to content

Commit

Permalink
random sleep time hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
bd21 committed Nov 21, 2023
1 parent ee44cba commit 4c43f8a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/noble/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"io"
"math/rand"
"net/http"
"regexp"
"strconv"
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down

0 comments on commit 4c43f8a

Please sign in to comment.