Remove duplicated project ids before performing sync

parent c150ae22
......@@ -60,7 +60,7 @@ class GeoRepositorySyncWorker
first.zip(second)
else
second.zip(first).map(&:reverse)
end.flatten(1).compact.take(BATCH_SIZE)
end.flatten(1).uniq.compact.take(BATCH_SIZE)
end
def over_time?(start_time)
......
......@@ -26,7 +26,15 @@ describe GeoRepositorySyncWorker do
last_repository_successful_sync_at: nil
)
expect(Geo::RepositorySyncService).to receive(:new).twice.and_return(spy)
Geo::ProjectRegistry.create(
project: project_2,
last_repository_synced_at: DateTime.now,
last_repository_successful_sync_at: DateTime.now,
resync_repository: false,
resync_wiki: false
)
expect(Geo::RepositorySyncService).to receive(:new).once.and_return(spy)
subject.perform
end
......
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