Skip to content

Commit

Permalink
add retry instead
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed May 1, 2024
1 parent 2b8b45d commit 9854843
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* [\#1326](https://github.com/cosmos/relayer/pull/1326) Avoid sending channel close confirm message after channel get closed successfully.
* [\#1364](https://github.com/cosmos/relayer/pull/1364) Include feegrant message when calculate gas.
* [\#1390](https://github.com/cosmos/relayer/pull/1390) Avoid no concrete type registered for type URL error of EthAccount.
* [\#1455](https://github.com/cosmos/relayer/pull/1455) Avoid counterparty recv packet message get removed before open channel.
* [\#1455](https://github.com/cosmos/relayer/pull/1455) Allow retry for pathEnd to avoid packet message get removed before open channel.

## v0.9.3

Expand Down
11 changes: 8 additions & 3 deletions relayer/processor/path_end_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type pathEndRuntime struct {
metrics *PrometheusMetrics

finishedProcessing chan messageToTrack
retryCount uint64
}

func newPathEndRuntime(log *zap.Logger, pathEnd PathEnd, metrics *PrometheusMetrics) *pathEndRuntime {
Expand Down Expand Up @@ -560,8 +561,12 @@ func (pathEnd *pathEndRuntime) shouldSendPacketMessage(message packetIBCMessage,
zap.Uint64("sequence", sequence),
zap.Inline(k),
)
pathEnd.removePacketRetention(counterparty, eventType, k, sequence)
return false
pathEnd.retryCount++
if pathEnd.retryCount >= maxMessageSendRetries {
pathEnd.removePacketRetention(counterparty, eventType, k, sequence)
pathEnd.retryCount = 0
return false
}
}
msgProcessCache, ok := pathEnd.packetProcessing[k]
if !ok {
Expand Down Expand Up @@ -637,7 +642,7 @@ func (pathEnd *pathEndRuntime) removePacketRetention(

// delete all packet flow retention history for this sequence
pathEnd.messageCache.PacketFlow[k].DeleteMessages(toDelete)
counterparty.messageCache.PacketFlow[k].DeleteMessages(toDeleteCounterparty)
counterparty.messageCache.PacketFlow[k.Counterparty()].DeleteMessages(toDeleteCounterparty)
}

// shouldSendConnectionMessage determines if the connection handshake message should be sent now.
Expand Down

0 comments on commit 9854843

Please sign in to comment.