2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module ObjectPool
|
2020-04-08 14:13:33 +05:30
|
|
|
class JoinWorker # rubocop:disable Scalability/IdempotentWorker
|
2019-02-15 15:39:39 +05:30
|
|
|
include ApplicationWorker
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
sidekiq_options retry: 3
|
2019-02-15 15:39:39 +05:30
|
|
|
include ObjectPoolQueue
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
worker_resource_boundary :cpu
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
# The use of pool id is deprecated. Keeping the argument allows old jobs to
|
|
|
|
# still be performed.
|
|
|
|
def perform(_pool_id, project_id)
|
2019-02-15 15:39:39 +05:30
|
|
|
project = Project.find_by_id(project_id)
|
2019-03-02 22:35:43 +05:30
|
|
|
return unless project&.pool_repository&.joinable?
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
project.link_pool_repository
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
Repositories::HousekeepingService.new(project).execute
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|