quiet the messages

This commit is contained in:
Cassandra Heart 2024-03-14 23:40:52 -05:00
parent 1b11e07095
commit ebd7f723c6
No known key found for this signature in database
GPG Key ID: 6352152859385958

View File

@ -30,50 +30,56 @@ func (e *CeremonyDataClockConsensusEngine) runMessageHandler() {
continue continue
} }
for name := range e.executionEngines { e.peerMapMx.RLock()
name := name peer, ok := e.peerMap[string(message.From)]
go func() error { e.peerMapMx.RUnlock()
messages, err := e.executionEngines[name].ProcessMessage(
msg.Address,
msg,
)
if err != nil {
e.logger.Debug(
"could not process message for engine",
zap.Error(err),
zap.String("engine_name", name),
)
return nil
}
for _, appMessage := range messages { if ok && bytes.Compare(peer.version, config.GetMinimumVersion()) >= 0 {
appMsg := &anypb.Any{} for name := range e.executionEngines {
err := proto.Unmarshal(appMessage.Payload, appMsg) name := name
go func() error {
messages, err := e.executionEngines[name].ProcessMessage(
msg.Address,
msg,
)
if err != nil { if err != nil {
e.logger.Error( e.logger.Debug(
"could not unmarshal app message", "could not process message for engine",
zap.Error(err), zap.Error(err),
zap.String("engine_name", name), zap.String("engine_name", name),
) )
continue return nil
} }
switch appMsg.TypeUrl { for _, appMessage := range messages {
case protobufs.CeremonyLobbyStateTransitionType: appMsg := &anypb.Any{}
t := &protobufs.CeremonyLobbyStateTransition{} err := proto.Unmarshal(appMessage.Payload, appMsg)
err := proto.Unmarshal(appMsg.Value, t)
if err != nil { if err != nil {
e.logger.Error(
"could not unmarshal app message",
zap.Error(err),
zap.String("engine_name", name),
)
continue continue
} }
if err := e.handleCeremonyLobbyStateTransition(t); err != nil { switch appMsg.TypeUrl {
continue case protobufs.CeremonyLobbyStateTransitionType:
t := &protobufs.CeremonyLobbyStateTransition{}
err := proto.Unmarshal(appMsg.Value, t)
if err != nil {
continue
}
if err := e.handleCeremonyLobbyStateTransition(t); err != nil {
continue
}
} }
} }
}
return nil return nil
}() }()
}
} }
any := &anypb.Any{} any := &anypb.Any{}
@ -84,12 +90,12 @@ func (e *CeremonyDataClockConsensusEngine) runMessageHandler() {
go func() { go func() {
switch any.TypeUrl { switch any.TypeUrl {
case protobufs.ClockFrameType: case protobufs.ClockFrameType:
e.peerMapMx.RLock() if !ok || bytes.Compare(
if peer, ok := e.peerMap[string(message.From)]; !ok || peer.version,
bytes.Compare(peer.version, config.GetMinimumVersion()) < 0 { config.GetMinimumVersion(),
) < 0 {
return return
} }
e.peerMapMx.RUnlock()
if err := e.handleClockFrameData( if err := e.handleClockFrameData(
message.From, message.From,
msg.Address, msg.Address,