Skip to content

Commit

Permalink
fix: making seed make sense on ws
Browse files Browse the repository at this point in the history
  • Loading branch information
ranlavanet committed Sep 10, 2024
1 parent 1c44c3c commit 7210b05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions protocol/chainlib/consumer_websocket_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/lavanet/lava/v3/protocol/common"
"github.com/lavanet/lava/v3/protocol/metrics"
"github.com/lavanet/lava/v3/utils"
"github.com/lavanet/lava/v3/utils/rand"
spectypes "github.com/lavanet/lava/v3/x/spec/types"
)

Expand Down Expand Up @@ -85,6 +86,7 @@ func (cwm *ConsumerWebsocketManager) ListenToMessages() {

webSocketCtx, cancelWebSocketCtx := context.WithCancel(context.Background())
guid := utils.GenerateUniqueIdentifier()
guidString := strconv.FormatUint(guid, 10)
webSocketCtx = utils.WithUniqueIdentifier(webSocketCtx, guid)
utils.LavaFormatDebug("consumer websocket manager started", utils.LogAttr("GUID", webSocketCtx))
defer func() {
Expand All @@ -110,7 +112,7 @@ func (cwm *ConsumerWebsocketManager) ListenToMessages() {

for {
startTime := time.Now()
msgSeed := logger.GetMessageSeed()
msgSeed := guidString + "_" + strconv.Itoa(rand.Intn(10000000000)) // use message seed with original guid and new int

utils.LavaFormatTrace("listening for new message from the websocket")

Expand All @@ -132,7 +134,6 @@ func (cwm *ConsumerWebsocketManager) ListenToMessages() {
}
}

msgSeed = strconv.FormatUint(guid, 10)
userIp := websocketConn.RemoteAddr().String()

logFormattedMsg := string(msg)
Expand Down

0 comments on commit 7210b05

Please sign in to comment.