Merge pull request #1133 from c9s/fix/batch-query/end-if-start-greater-than-end

FIX: end batch query if start > end
This commit is contained in:
Yo-An Lin 2023-03-27 16:09:01 +08:00 committed by GitHub
commit 6d8b3d7f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,16 +72,11 @@ func (q *AsyncTimeRangedBatchQuery) Query(ctx context.Context, ch interface{}, s
if listLen == 0 { if listLen == 0 {
if q.JumpIfEmpty > 0 { if q.JumpIfEmpty > 0 {
startTime2 := startTime.Add(q.JumpIfEmpty) startTime = startTime.Add(q.JumpIfEmpty)
if startTime2.After(endTime) { if startTime.Before(endTime) {
startTime = endTime log.Debugf("batch querying %T: empty records jump to %s", q.Type, startTime)
endTime = startTime2 continue
} else {
startTime = startTime.Add(q.JumpIfEmpty)
} }
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) log.Debugf("batch querying %T: empty records, query is completed", q.Type)