2018-12-17 03:49:38 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module ObjectPool
|
2020-02-19 13:09:10 -05:00
|
|
|
class DestroyWorker # rubocop:disable Scalability/IdempotentWorker
|
2018-12-17 03:49:38 -05:00
|
|
|
include ApplicationWorker
|
2021-04-30 14:10:09 -04:00
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
2018-12-17 03:49:38 -05:00
|
|
|
include ObjectPoolQueue
|
|
|
|
|
|
|
|
def perform(pool_repository_id)
|
|
|
|
pool = PoolRepository.find_by_id(pool_repository_id)
|
|
|
|
return unless pool&.obsolete?
|
|
|
|
|
|
|
|
pool.delete_object_pool
|
|
|
|
pool.destroy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|