debian-mirror-gitlab/app/workers/object_pool/join_worker.rb

22 lines
568 B
Ruby
Raw Normal View History

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
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
Projects::HousekeepingService.new(project).execute
end
end
end