Class: Ci::Runners::BulkDeleteRunnersService

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

Constant Summary collapse

RUNNER_LIMIT =
50

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runners:, current_user:) ⇒ BulkDeleteRunnersService

Returns a new instance of BulkDeleteRunnersService.

Parameters:

  • runners (Array<Ci::Runner>)

    the runners to unregister/destroy

  • current_user (User)

    the user performing the operation



12
13
14
15
# File 'app/services/ci/runners/bulk_delete_runners_service.rb', line 12

def initialize(runners:, current_user:)
  @runners = runners
  @current_user = current_user
end

Instance Attribute Details

#runnersObject (readonly)

Returns the value of attribute runners.



6
7
8
# File 'app/services/ci/runners/bulk_delete_runners_service.rb', line 6

def runners
  @runners
end

Instance Method Details

#executeObject



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

def execute
  if @runners
    # Delete a few runners immediately
    return delete_runners
  end

  ServiceResponse.success(payload: { deleted_count: 0, deleted_ids: [], errors: [] })
end