blob: 9e3e6de3928e573b96b83594afc1c8fad5d18dc7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# frozen_string_literal: true
module Ci
module ResourceGroups
class AssignResourceFromResourceGroupService < ::BaseService
# rubocop: disable CodeReuse/ActiveRecord
def execute(resource_group)
free_resources = resource_group.resources.free.count
resource_group.processables.waiting_for_resource.take(free_resources).each do |processable|
processable.enqueue_waiting_for_resource
end
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
|