Skip to content

Commit

Permalink
refac code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanut Lertwarachai authored and Tanut Lertwarachai committed Feb 3, 2025
1 parent 45cbbab commit 8912bcf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions relayer/tunnel_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ func (t *TunnelRelayer) CheckAndRelay(ctx context.Context) (err error) {
return err
}

if relayermetrics.IsTelemetryEnabled() {
// update the metric for unrelayed packets based on the difference between the latest sequences on BandChain and the target chain
relayermetrics.SetUnrelayedPacket(
t.TunnelID,
float64(tunnelBandInfo.LatestSequence-tunnelChainInfo.LatestSequence),
)
}

if !tunnelChainInfo.IsActive {
// decrease active status and increase inactive status if the tunnel was previously active
if t.IsTargetChainActive && relayermetrics.IsTelemetryEnabled() {
Expand All @@ -94,14 +102,6 @@ func (t *TunnelRelayer) CheckAndRelay(ctx context.Context) (err error) {
t.IsTargetChainActive = true
}

if relayermetrics.IsTelemetryEnabled() {
// update the metric for unrelayed packets based on the difference between the latest sequences on BandChain and the target chain
relayermetrics.SetUnrelayedPacket(
t.TunnelID,
float64(tunnelBandInfo.LatestSequence-tunnelChainInfo.LatestSequence),
)
}

// end process if current packet is already relayed
seq := tunnelChainInfo.LatestSequence + 1
if tunnelBandInfo.LatestSequence < seq {
Expand Down

0 comments on commit 8912bcf

Please sign in to comment.