From a6a6fcfb1c68e7f006e77f13bdb3b54cd3d2cdb6 Mon Sep 17 00:00:00 2001 From: Duong Minh Ngoc Date: Wed, 17 Jan 2024 17:21:54 +0700 Subject: [PATCH] handle error while sending in batch --- x/feeabs/keeper/ibc.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x/feeabs/keeper/ibc.go b/x/feeabs/keeper/ibc.go index 0d904cc8..b4f35231 100644 --- a/x/feeabs/keeper/ibc.go +++ b/x/feeabs/keeper/ibc.go @@ -274,6 +274,7 @@ func (k Keeper) handleOsmosisIbcQuery(ctx sdk.Context) error { batchSize := 10 var reqs []types.QueryArithmeticTwapToNowRequest batchCounter := 0 + var errorFound error k.IterateHostZone(ctx, func(hostZoneConfig types.HostChainFeeAbsConfig) (stop bool) { if hostZoneConfig.Frozen { return false @@ -289,6 +290,7 @@ func (k Keeper) handleOsmosisIbcQuery(ctx sdk.Context) error { if batchCounter == batchSize { err := k.SendOsmosisQueryRequest(ctx, reqs, types.IBCPortID, params.IbcQueryIcqChannel) if err != nil { + errorFound = err return true } reqs = []types.QueryArithmeticTwapToNowRequest{} @@ -297,6 +299,10 @@ func (k Keeper) handleOsmosisIbcQuery(ctx sdk.Context) error { return false }) + if errorFound != nil { + return errorFound + } + if len(reqs) > 0 { err := k.SendOsmosisQueryRequest(ctx, reqs, types.IBCPortID, params.IbcQueryIcqChannel) if err != nil {