summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2019-01-08 13:02:58 +0100
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2019-01-14 16:09:47 +0100
commite03602e09de5d72b3bc5aee0df2a42807456a391 (patch)
tree1cd167e4e306ac4e1030676eea1db33bd7fad741 /app/workers
parent94d05e3c5ce59448d63ee96e3474b0cd3ef2c995 (diff)
downloadgitlab-ce-e03602e09de5d72b3bc5aee0df2a42807456a391.tar.gz
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.
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/git_garbage_collect_worker.rb1
-rw-r--r--app/workers/object_pool/join_worker.rb11
2 files changed, 6 insertions, 6 deletions
diff --git a/app/workers/git_garbage_collect_worker.rb b/app/workers/git_garbage_collect_worker.rb
index d3628b23189..b33e9b1f718 100644
--- a/app/workers/git_garbage_collect_worker.rb
+++ b/app/workers/git_garbage_collect_worker.rb
@@ -23,6 +23,7 @@ class GitGarbageCollectWorker
end
task = task.to_sym
+ project.link_pool_repository
gitaly_call(task, project.repository.raw_repository)
# Refresh the branch cache in case garbage collection caused a ref lookup to fail
diff --git a/app/workers/object_pool/join_worker.rb b/app/workers/object_pool/join_worker.rb
index 07676011b2a..9c5161fd55a 100644
--- a/app/workers/object_pool/join_worker.rb
+++ b/app/workers/object_pool/join_worker.rb
@@ -5,14 +5,13 @@ module ObjectPool
include ApplicationWorker
include ObjectPoolQueue
- def perform(pool_id, project_id)
- pool = PoolRepository.find_by_id(pool_id)
- return unless pool&.joinable?
-
+ # 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
+ return unless project&.pool_repository&.joinable?
- pool.link_repository(project.repository)
+ project.link_pool_repository
Projects::HousekeepingService.new(project).execute
end