Class: Ci::UpdatePendingBuildService

Inherits:
Object
  • Object
show all
Defined in:
app/services/ci/update_pending_build_service.rb

Constant Summary collapse

VALID_PARAMS =
%i[instance_runners_enabled namespace_id namespace_traversal_ids].freeze
InvalidParamsError =
Class.new(StandardError)
InvalidModelError =
Class.new(StandardError)

Instance Method Summary collapse

Constructor Details

#initialize(model, update_params) ⇒ UpdatePendingBuildService

Returns a new instance of UpdatePendingBuildService.


10
11
12
13
14
15
# File 'app/services/ci/update_pending_build_service.rb', line 10

def initialize(model, update_params)
  @model = model
  @update_params = update_params.symbolize_keys

  validations!
end

Instance Method Details

#executeObject


17
18
19
20
21
22
23
# File 'app/services/ci/update_pending_build_service.rb', line 17

def execute
  return unless ::Ci::PendingBuild.maintain_denormalized_data?

  @model.pending_builds.each_batch do |relation|
    relation.update_all(@update_params)
  end
end