From df54196a144d088a0621c916c34061c456362f06 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 8 Nov 2024 05:00:15 -0500 Subject: [PATCH] Use `touch_all` with batches (#32799) --- app/controllers/admin/invites_controller.rb | 2 +- app/models/user.rb | 2 +- app/services/unallow_domain_service.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/invites_controller.rb b/app/controllers/admin/invites_controller.rb index dabfe97655..614e2a32d0 100644 --- a/app/controllers/admin/invites_controller.rb +++ b/app/controllers/admin/invites_controller.rb @@ -32,7 +32,7 @@ module Admin def deactivate_all authorize :invite, :deactivate_all? - Invite.available.in_batches.update_all(expires_at: Time.now.utc) + Invite.available.in_batches.touch_all(:expires_at) redirect_to admin_invites_path end diff --git a/app/models/user.rb b/app/models/user.rb index 69c5a01569..8827a8fbd6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -340,7 +340,7 @@ class User < ApplicationRecord Doorkeeper::AccessGrant.by_resource_owner(self).update_all(revoked_at: Time.now.utc) Doorkeeper::AccessToken.by_resource_owner(self).in_batches do |batch| - batch.update_all(revoked_at: Time.now.utc) + batch.touch_all(:revoked_at) Web::PushSubscription.where(access_token_id: batch).delete_all # Revoke each access token for the Streaming API, since `update_all`` diff --git a/app/services/unallow_domain_service.rb b/app/services/unallow_domain_service.rb index bdc71b1c08..bbe9571450 100644 --- a/app/services/unallow_domain_service.rb +++ b/app/services/unallow_domain_service.rb @@ -12,7 +12,7 @@ class UnallowDomainService < BaseService private def suspend_accounts!(domain) - Account.where(domain: domain).in_batches.update_all(suspended_at: Time.now.utc) + Account.where(domain: domain).in_batches.touch_all(:suspended_at) AfterUnallowDomainWorker.perform_async(domain) end end