Class: Ci::DeleteObjectsService

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

Constant Summary collapse

TransactionInProgressError =
Class.new(StandardError)
TRANSACTION_MESSAGE =
"can't perform network calls inside a database transaction"
BATCH_SIZE =
100
RETRY_IN =
10.minutes

Instance Method Summary collapse

Instance Method Details

#executeObject



10
11
12
13
# File 'app/services/ci/delete_objects_service.rb', line 10

def execute
  objects = load_next_batch
  destroy_everything(objects)
end

#remaining_batches_count(max_batch_count:) ⇒ Object



15
16
17
18
19
20
21
# File 'app/services/ci/delete_objects_service.rb', line 15

def remaining_batches_count(max_batch_count:)
  Ci::DeletedObject
    .ready_for_destruction(max_batch_count * BATCH_SIZE)
    .size
    .fdiv(BATCH_SIZE)
    .ceil
end