Remove unnecessary check from GeoBackfillWorker

parent d338e3f7
...@@ -21,6 +21,11 @@ class GeoBackfillWorker ...@@ -21,6 +21,11 @@ class GeoBackfillWorker
project = Project.find(project_id) project = Project.find(project_id)
next if synced?(project) next if synced?(project)
# We try to obtain a lease here for the entire backfilling process
# because backfill the repositories continuously at a controlled rate
# instead of hammering the primary node. Initially, we are backfilling
# one repo at a time. If we don't obtain the lease here, every 5
# minutes all of 100 projects will be synced.
try_obtain_lease do |lease| try_obtain_lease do |lease|
GeoSingleRepositoryBackfillWorker.new.perform(project_id, lease) GeoSingleRepositoryBackfillWorker.new.perform(project_id, lease)
end end
...@@ -36,8 +41,6 @@ class GeoBackfillWorker ...@@ -36,8 +41,6 @@ class GeoBackfillWorker
private private
def find_project_ids def find_project_ids
return [] if Project.count == Geo::ProjectRegistry.count
Project.where.not(id: Geo::ProjectRegistry.pluck(:project_id)) Project.where.not(id: Geo::ProjectRegistry.pluck(:project_id))
.limit(BATCH_SIZE) .limit(BATCH_SIZE)
.pluck(:id) .pluck(: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