Skip to content

Commit

Permalink
Tie available and dequeued logs together
Browse files Browse the repository at this point in the history
  • Loading branch information
ferglor committed Jul 18, 2024
1 parent c6065d4 commit 26b90a8
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,6 @@ func (b *logBuffer) dequeue(start int64, capacity int, minimumDequeue bool) ([]B
}
queuesInRange++

upkeepAvailableLogs, ok := b.availableLogs[qid]
if !ok {
upkeepAvailableLogs = map[int64][]int{}
}

series2, ok3 := upkeepAvailableLogs[start]
if !ok3 {
series2 = []int{logsInRange}
} else {
series2 = append(series2, logsInRange)
}

upkeepAvailableLogs[start] = series2

b.availableLogs[qid] = upkeepAvailableLogs

if capacity == 0 {
// if there is no more capacity for results, just count the remaining logs
remainingLogs += logsInRange
Expand All @@ -247,6 +231,22 @@ func (b *logBuffer) dequeue(start int64, capacity int, minimumDequeue bool) ([]B
// update the buffer with how many logs we have dequeued for this window
q.dequeued[start] += len(logs)

upkeepAvailableLogs, ok := b.availableLogs[qid]
if !ok {
upkeepAvailableLogs = map[int64][]int{}
}

series2, ok3 := upkeepAvailableLogs[start]
if !ok3 {
series2 = []int{logsInRange}
} else {
series2 = append(series2, logsInRange)
}

upkeepAvailableLogs[start] = series2

b.availableLogs[qid] = upkeepAvailableLogs

dequeuedLogs, ok := b.dequeuedLogs[qid]
if !ok {
dequeuedLogs = map[int64][]int{}
Expand Down

0 comments on commit 26b90a8

Please sign in to comment.