batch: fix JumpIfEmpty algorithm

This commit is contained in:
c9s 2023-02-09 17:11:26 +08:00
parent 5bbe4ecd57
commit 2fed98ea55
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

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