@@ -286,7 +286,12 @@ func (ccp *WasmChainProcessor) Run(ctx context.Context, initialBlockHistory uint
286
286
287
287
ccp .log .Debug ("Entering Wasm main query loop" )
288
288
if ccp .chainProvider .rangeSupport {
289
- inSyncNumBlocksThreshold = 10
289
+ inSyncNumBlocksThreshold = 15
290
+ defaultQueryLoopTime := 7
291
+ if ccp .chainProvider .PCfg .BlockRPCRefreshTime > 0 {
292
+ defaultQueryLoopTime = ccp .chainProvider .PCfg .BlockRPCRefreshTime
293
+ }
294
+ persistence .minQueryLoopDuration = time .Duration (defaultQueryLoopTime ) * time .Second
290
295
}
291
296
ticker := time .NewTicker (persistence .minQueryLoopDuration )
292
297
defer ticker .Stop ()
@@ -461,7 +466,14 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer
461
466
var blocks []int64
462
467
heighttoSync := syncUpHeight ()
463
468
delta := persistence .latestHeight - persistence .latestQueriedBlock
464
- if ccp .chainProvider .rangeSupport && delta > 20 {
469
+ minDelta := 10
470
+ if ccp .chainProvider .PCfg .BlockRPCMinDelta > 0 {
471
+ minDelta = ccp .chainProvider .PCfg .BlockRPCMinDelta
472
+ }
473
+ if ccp .chainProvider .rangeSupport && delta > int64 (minDelta ) {
474
+ ccp .log .Debug ("Fetching range block" ,
475
+ zap .Any ("last_height" , persistence .latestQueriedBlock ),
476
+ zap .Any ("delta" , delta ))
465
477
status , err := ccp .chainProvider .BlockRPCClient .Status (ctx )
466
478
if err != nil {
467
479
return nil
0 commit comments