Skip to content

Commit

Permalink
Merge pull request #170 from Homebrew/increase-long-build-slots
Browse files Browse the repository at this point in the history
  • Loading branch information
carlocab committed Sep 16, 2024
2 parents c37279d + 4d9c9f9 commit 05472be
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/job_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def initialize(queue_type)
@queue = Hash.new { |h, k| h[k] = [] }
@queue_type = queue_type
@condvar = ConditionVariable.new

# Ideally, @long_build_slots + @dispatch_build_slots < QueueTypes.slots(@queue_type).
@long_build_slots = QueueTypes.slots(@queue_type) / 2
@dispatch_build_slots = QueueTypes.slots(@queue_type) / 4
end

def <<(job)
Expand All @@ -33,12 +37,9 @@ def pop
running_long_build_count = running_jobs.count(&:long_build?)
running_dispatch_build_count = running_jobs.count(&:dispatch_job?)

# TODO: Change this to `/ 2` when Sequoia bottling is done.
non_default_build_slots = QueueTypes.slots(@queue_type) / 3

if running_long_build_count < non_default_build_slots && !@queue[:long].empty?
if running_long_build_count < @long_build_slots && !@queue[:long].empty?
break @queue[:long].shift
elsif running_dispatch_build_count < non_default_build_slots && !@queue[:dispatch].empty?
elsif running_dispatch_build_count < @dispatch_build_slots && !@queue[:dispatch].empty?
break @queue[:dispatch].shift
elsif !@queue[:default].empty?
break @queue[:default].shift
Expand Down

0 comments on commit 05472be

Please sign in to comment.