Skip to content

Commit

Permalink
Cleanup Consume()
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-sili committed Oct 10, 2024
1 parent 3a42e45 commit 7217432
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions exporter/internal/queue/persistent_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,6 @@ func (pq *persistentQueue[T]) restoreQueueSizeFromStorage(ctx context.Context) (
return bytesToItemIndex(val)
}

// Consume applies the provided function on the head of queue.
// The call blocks until there is an item available or the queue is stopped.
// The function returns true when an item is consumed or false if the queue is stopped.
func (pq *persistentQueue[T]) Consume(consumeFunc func(context.Context, T) error) bool {
index, _, req, ok := pq.Read(context.Background())
if !ok {
return false
}
consumeErr := consumeFunc(context.Background(), req)
pq.OnProcessingFinished(index, consumeErr)
return true

}

func (pq *persistentQueue[T]) Shutdown(ctx context.Context) error {
// If the queue is not initialized, there is nothing to shut down.
if pq.client == nil {
Expand Down

0 comments on commit 7217432

Please sign in to comment.