Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(priority): Ability to push back PRs to the back of the queue #854

Open
erezrokah opened this issue Nov 3, 2022 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@erezrokah
Copy link

erezrokah commented Nov 3, 2022

TLDR: Similar to priority_merge_label but low_priority_merge_label, where a PR is scheduled last.

This is useful for bots PRs, where we want them to always come after humans' PRs.

Found a few priority related issues, but not quite like this

Also not sure if it will work to use priority_merge_label: automerge and automerge_label: low priority as I remember one needs both to be in the queue

@erezrokah erezrokah added the enhancement New feature or request label Nov 3, 2022
@chdsbd
Copy link
Owner

chdsbd commented Nov 4, 2022

@erezrokah Thanks for the suggestion. I think the implementation would be similar to priority_merge_label. For pull requests labeled with priority_merge_label, we insert them into the Redis Sorted Set with a score of 0 instead of using the current unix timestamp as the score.

For low_priority_merge_label, we could insert the pull requests into the queue with some very high timestamp, like 4800000000, to prioritize these pull requests last.

priority_merge = config.merge.priority_merge_label in pull_request.labels
position_in_queue = await api.queue_for_merge(first=priority_merge)

kodiak/bot/kodiak/queue.py

Lines 588 to 592 in ee3cd8e

if first:
# place at front of queue. To allow us to always place this PR at
# the front, we should not pass only_if_not_exists.
await transaction.zadd(queue_name, {event.json(): 1.0})
else:

@erezrokah
Copy link
Author

Thanks for the quick response @chdsbd, I can try and submit a PR for it if that makes sense

@chdsbd
Copy link
Owner

chdsbd commented Nov 7, 2022

@erezrokah A PR would be great! I can help with tests and polish if you need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants