Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: prioritize human-initiated workspace builds over prebuilds in queue#18882

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

blink-so[bot]
Copy link
Contributor

@blink-soblink-sobot commentedJul 15, 2025
edited
Loading

Summary

Implements a priority queue system for provisioner jobs to ensure human-initiated workspace builds are processed before prebuild jobs, improving user experience during high queue periods.

Changes

  • Queue Logic: UpdatedAcquireProvisionerJob query to useCASE WHEN oninitiator_id to order by priority
  • Priority Assignment: Human-initiated jobs get priority 1, prebuilds get priority 0 (via SQL CASE WHEN)
  • Testing: Updated comprehensive test to verify priority queue behavior using initiator_id

How it works

  1. TheAcquireProvisionerJob query now uses aCASE WHEN statement to prioritize jobs:
    • Jobs withinitiator_id != PrebuildsSystemUserID get priority 1 (human-initiated)
    • Jobs withinitiator_id = PrebuildsSystemUserID get priority 0 (prebuilds)
  2. The query orders by this calculated priority first, then creation time
  3. This ensures human jobs are always acquired before prebuild jobs, regardless of creation time

Testing

  • Updated unit test that verifies priority-based job acquisition
  • Test creates both human and prebuild jobs and confirms acquisition order
  • Existing tests continue to pass as the change is backward compatible

Impact

  • Users: Faster workspace build times when prebuilds are queued
  • System: No performance impact, just changes query ordering
  • Backward Compatibility: No migrations required, works with existing data

Related to provisioner queue issues like#15843 and#16488 - this addresses the specific case where prebuilds can delay human-initiated workspace builds during busy periods.

…ueueThis change implements a priority queue system for provisioner jobs to ensurethat human-initiated workspace builds are processed before prebuild jobs,improving user experience during high queue periods.Changes:- Add priority column to provisioner_jobs table (1=human, 0=prebuild)- Update AcquireProvisionerJob query to order by priority DESC, created_at ASC- Set priority in workspace builder based on initiator (PrebuildsSystemUserID)- Expose priority field in API and SDK- Add comprehensive test for priority queue behaviorCo-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
Copy link
Member

@johnstcnjohnstcn left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd rather not add a new column here, as this requires a migration and migrations are difficult to backport, and this seems like something we would want to backport. We could instead add an explicitCASE WHEN oninitiator_id to perform the ordering.

EDIT: can you please also link an associated GH issue, if it exists?

johnstcn added a commit that referenced this pull requestJul 22, 2025
Continues from#18882- Reverts extraneous changes- Adds explicit `ORDER BY initiator_id = $PREBUILDS_USER_ID` to`AcquireProvisionerJob`- Improves test added for above PR---------Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
@mtojek
Copy link
Member

I guess we can close it now.

@mtojekmtojek closed thisJul 28, 2025
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJul 28, 2025
Address review feedback by removing the priority column migrationand instead using a CASE WHEN statement in the AcquireProvisionerJobquery to prioritize human-initiated jobs over prebuilds.This approach avoids the need for a migration while maintainingthe same functionality.Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
@blink-soblink-sobot reopened thisJul 28, 2025
@mtojekmtojek closed thisJul 28, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn requested changes

@SasSwartSasSwartAwaiting requested review from SasSwart

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@mtojek@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp