gitlab-org--gitlab-foss/app/workers/object_pool/destroy_worker.rb
Zeger-Jan van de Weg 752e9c18a1
Leave object pools when destroying projects
This action doesn't lean on reduplication, so a short call can me made
to the Gitaly server to have the object pool remove its remote to the
project pending deletion.
https://gitlab.com/gitlab-org/gitaly/blob/f6cd55357/internal/git/objectpool/link.go#L58

When an object pool doesn't have members, this would invalidate the need
for a pool. So when a project leaves the pool, the pool will be
destroyed on the background.

Fixes: https://gitlab.com/gitlab-org/gitaly/issues/1415
2018-12-19 13:21:56 +01:00

16 lines
329 B
Ruby

# frozen_string_literal: true
module ObjectPool
class DestroyWorker
include ApplicationWorker
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