diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-07 15:19:43 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-07 15:19:43 +0200 |
commit | b41b4d2e6a44a04fc3e6fff09cf45f93033ff0ad (patch) | |
tree | d2b48bb242119e451ecb3052c9a28d0a50af4441 /app | |
parent | b7b3aef444bba457b4967ee7fa122527853a2eb5 (diff) | |
download | gitlab-ce-b41b4d2e6a44a04fc3e6fff09cf45f93033ff0ad.tar.gz |
Use new `each_batch` helper instead of custom one
In stage_id backgrond migration.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/each_batch.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/concerns/each_batch.rb b/app/models/concerns/each_batch.rb index 6610e7967d1..53979c4c683 100644 --- a/app/models/concerns/each_batch.rb +++ b/app/models/concerns/each_batch.rb @@ -35,7 +35,7 @@ module EachBatch start_id = start[primary_key] arel_table = self.arel_table - loop do + 1.step do |index| stop = except(:select) .select(primary_key) .where(arel_table[primary_key].gteq(start_id)) @@ -54,7 +54,7 @@ module EachBatch # Any ORDER BYs are useless for this relation and can lead to less # efficient UPDATE queries, hence we get rid of it. - yield relation.except(:order) + yield relation.except(:order), index break unless stop end |