summaryrefslogtreecommitdiff
path: root/lib/gitlab/background_migration/expire_o_auth_tokens.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
commit05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch)
tree11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /lib/gitlab/background_migration/expire_o_auth_tokens.rb
parentec73467c23693d0db63a797d10194da9e72a74af (diff)
downloadgitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'lib/gitlab/background_migration/expire_o_auth_tokens.rb')
-rw-r--r--lib/gitlab/background_migration/expire_o_auth_tokens.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/gitlab/background_migration/expire_o_auth_tokens.rb b/lib/gitlab/background_migration/expire_o_auth_tokens.rb
index 08bcdb8a789..20dacd642de 100644
--- a/lib/gitlab/background_migration/expire_o_auth_tokens.rb
+++ b/lib/gitlab/background_migration/expire_o_auth_tokens.rb
@@ -4,21 +4,15 @@ module Gitlab
module BackgroundMigration
# Add expiry to all OAuth access tokens
class ExpireOAuthTokens < ::Gitlab::BackgroundMigration::BatchedMigrationJob
- operation_name :update_oauth_tokens
+ scope_to ->(relation) { relation.where(expires_in: nil) }
+ operation_name :update_all
+ feature_category :database
def perform
- each_sub_batch(
- batching_scope: ->(relation) { relation.where(expires_in: nil) }
- ) do |sub_batch|
- update_oauth_tokens(sub_batch)
+ each_sub_batch do |sub_batch|
+ sub_batch.update_all(expires_in: 2.hours)
end
end
-
- private
-
- def update_oauth_tokens(relation)
- relation.update_all(expires_in: 7_200)
- end
end
end
end