From 81799f2c49081bcef3f4a8d3f00091f002dfb01a Mon Sep 17 00:00:00 2001 From: chiahung Date: Mon, 27 Mar 2023 16:03:06 +0800 Subject: [PATCH] FIX: end batch query if start > end --- pkg/exchange/batch/time_range_query.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pkg/exchange/batch/time_range_query.go b/pkg/exchange/batch/time_range_query.go index 852b23e8f..7b8490c59 100644 --- a/pkg/exchange/batch/time_range_query.go +++ b/pkg/exchange/batch/time_range_query.go @@ -72,16 +72,11 @@ func (q *AsyncTimeRangedBatchQuery) Query(ctx context.Context, ch interface{}, s if listLen == 0 { if q.JumpIfEmpty > 0 { - startTime2 := startTime.Add(q.JumpIfEmpty) - if startTime2.After(endTime) { - startTime = endTime - endTime = startTime2 - } else { - startTime = startTime.Add(q.JumpIfEmpty) + startTime = startTime.Add(q.JumpIfEmpty) + if startTime.Before(endTime) { + log.Debugf("batch querying %T: empty records jump to %s", q.Type, startTime) + continue } - - log.Debugf("batch querying %T: empty records jump to %s", q.Type, startTime) - continue } log.Debugf("batch querying %T: empty records, query is completed", q.Type)