Check if project repository exists before scheduling removal

parent 389dce86
...@@ -2,6 +2,7 @@ module Geo ...@@ -2,6 +2,7 @@ module Geo
class RepositoriesCleanUpWorker class RepositoriesCleanUpWorker
include Sidekiq::Worker include Sidekiq::Worker
include GeoQueue include GeoQueue
include Gitlab::ShellAdapter
BATCH_SIZE = 250 BATCH_SIZE = 250
LEASE_TIMEOUT = 60.minutes LEASE_TIMEOUT = 60.minutes
...@@ -27,6 +28,9 @@ module Geo ...@@ -27,6 +28,9 @@ module Geo
private private
def clean_up_repositories(project) def clean_up_repositories(project)
# There is a possibility project does not have repository or wiki
return true unless gitlab_shell.exists?(project.repository_storage_path, "#{project.disk_path}.git")
job_id = ::GeoRepositoryDestroyWorker.perform_async(project.id, project.name, project.full_path) job_id = ::GeoRepositoryDestroyWorker.perform_async(project.id, project.name, project.full_path)
if job_id if job_id
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment