Class: Events::DestroyService
- Inherits:
-
Object
- Object
- Events::DestroyService
- Defined in:
- app/services/events/destroy_service.rb
Constant Summary collapse
- BATCH_SIZE =
50
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project) ⇒ DestroyService
constructor
A new instance of DestroyService.
Constructor Details
#initialize(project) ⇒ DestroyService
Returns a new instance of DestroyService.
7 8 9 |
# File 'app/services/events/destroy_service.rb', line 7 def initialize(project) @project = project end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/events/destroy_service.rb', line 11 def execute loop do count = delete_events_in_batches break if count < BATCH_SIZE end ServiceResponse.success(message: 'Events were deleted.') rescue StandardError => e ServiceResponse.error(message: e.) end |