Skip to content

Add PriorityQueue function#50

Open
destel wants to merge 4 commits intomainfrom
f/priority-queue
Open

Add PriorityQueue function#50
destel wants to merge 4 commits intomainfrom
f/priority-queue

Conversation

@destel
Copy link
Owner

@destel destel commented Dec 3, 2024

Add PriorityQueue function that allows injecting priority queues into pipelines.

The function takes a regular channel and returns a new one that emits items in priority order:

func PriorityQueue[A any](in <-chan Try[A], capacity int, less func(A, A) bool) <-chan Try[A]

Example usage:

// Process items from highest to lowest priority
itemsPrioritized := rill.PriorityQueue(items, 10, func(a, b Item) bool {
    return a.Priority > b.Priority
})

@destel destel added the new label Dec 3, 2024
@codecov
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 74.26901% with 44 lines in your changes missing coverage. Please review.

Project coverage is 95.53%. Comparing base (b38495b) to head (f8e1135).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
internal/heapbuffer/buffer.go 0.00% 24 Missing ⚠️
buffer.go 0.00% 11 Missing ⚠️
internal/core/buffer.go 81.25% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #50      +/-   ##
==========================================
- Coverage   99.11%   95.53%   -3.59%     
==========================================
  Files          17       21       +4     
  Lines        1015     1186     +171     
==========================================
+ Hits         1006     1133     +127     
- Misses          9       52      +43     
- Partials        0        1       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant