Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-05-05 11:43:56 +0300
committerJames Lopez <james@jameslopez.es>2017-05-05 11:43:56 +0300
commitadcff298f8f3041faa29b75ee3711fb4ce1cbb69 (patch)
tree35c1c8a3239d5f87ebeaa17489d399915ade4b0f /app/services
parent1fe8b7f646603239f530b1a18427f4f5bc0e2060 (diff)
fixed all issues - not doing bulk create.
Diffstat (limited to 'app/services')
-rw-r--r--app/services/projects/propagate_service.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/app/services/projects/propagate_service.rb b/app/services/projects/propagate_service.rb
index b067fc2cd64..716a6209537 100644
--- a/app/services/projects/propagate_service.rb
+++ b/app/services/projects/propagate_service.rb
@@ -21,16 +21,12 @@ module Projects
private
def propagate_projects_with_template
- offset = 0
-
loop do
- batch = project_ids_batch(offset)
+ batch = project_ids_batch
bulk_create_from_template(batch)
break if batch.size < BATCH_SIZE
-
- offset += BATCH_SIZE
end
end
@@ -44,7 +40,7 @@ module Projects
end
end
- def project_ids_batch(offset)
+ def project_ids_batch
Project.connection.execute(
<<-SQL
SELECT id
@@ -55,7 +51,7 @@ module Projects
WHERE services.project_id = projects.id
AND services.type = '#{@template.type}'
)
- LIMIT #{BATCH_SIZE} OFFSET #{offset}
+ LIMIT #{BATCH_SIZE}
SQL
).to_a.flatten
end