summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-07-07 14:49:05 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-07-07 14:49:05 +0200
commit5f9c84584efd5a7cbe19ada49fdccefbd5f54aea (patch)
tree0b5d591e04ea498e1c0dbaa9c18d9200709e930c /lib
parentd40445e4c9964ae0ab793bfdd7ba530de4259716 (diff)
downloadgitlab-ce-5f9c84584efd5a7cbe19ada49fdccefbd5f54aea.tar.gz
Added EachBatch for iterating tables in batches
This module provides a class method called `each_batch` that can be used to iterate tables in batches in a more efficient way compared to Rails' `in_batches` method. This commit also includes a RuboCop cop to blacklist the use of `in_batches` in favour of this new method.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/otp_key_rotator.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/otp_key_rotator.rb b/lib/gitlab/otp_key_rotator.rb
index 0d541935bc6..22332474945 100644
--- a/lib/gitlab/otp_key_rotator.rb
+++ b/lib/gitlab/otp_key_rotator.rb
@@ -34,7 +34,7 @@ module Gitlab
write_csv do |csv|
ActiveRecord::Base.transaction do
- User.with_two_factor.in_batches do |relation|
+ User.with_two_factor.in_batches do |relation| # rubocop: disable Cop/InBatches
rows = relation.pluck(:id, :encrypted_otp_secret, :encrypted_otp_secret_iv, :encrypted_otp_secret_salt)
rows.each do |row|
user = %i[id ciphertext iv salt].zip(row).to_h