gitlab-org--gitlab-foss/app/workers/object_pool/join_worker.rb
Zeger-Jan van de Weg e03602e09d
Ensure pool participants are linked before GC
In theory the case could happen that the initial linking of the pool
fails and so do all the retries that Sidekiq performs. This could lead
to data loss.

To prevent that case, linking is done before Gits GC too. This makes
sure that case doesn't happen.
2019-01-14 16:09:47 +01:00

19 lines
486 B
Ruby

# frozen_string_literal: true
module ObjectPool
class JoinWorker
include ApplicationWorker
include ObjectPoolQueue
# The use of pool id is deprecated. Keeping the argument allows old jobs to
# still be performed.
def perform(_pool_id, project_id)
project = Project.find_by_id(project_id)
return unless project&.pool_repository&.joinable?
project.link_pool_repository
Projects::HousekeepingService.new(project).execute
end
end
end