fix: RemoveStaleRedisKeys service (#10562)
Fixes issues with RemoveStaleRedisKeys service Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
@@ -6,6 +6,7 @@ class Internal::ProcessStaleRedisKeysJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform(account)
|
||||
Internal::RemoveStaleRedisKeysService.new(account_id: account.id).perform
|
||||
removed_count = Internal::RemoveStaleRedisKeysService.new(account_id: account.id).perform
|
||||
Rails.logger.info "Successfully cleaned up Redis keys for account #{account.id} (removed #{removed_count} keys)"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,9 +6,11 @@ class Internal::RemoveStaleRedisKeysJob < ApplicationJob
|
||||
queue_as :scheduled_jobs
|
||||
|
||||
def perform
|
||||
Account.find_each do |account|
|
||||
Rails.logger.info "Enqueuing ProcessStaleRedisKeysJob for account #{account.id}"
|
||||
Internal::ProcessStaleRedisKeysJob.perform_later(account)
|
||||
Account.find_in_batches(batch_size: 100) do |accounts|
|
||||
accounts.each do |account|
|
||||
Rails.logger.info "Enqueuing ProcessStaleRedisKeysJob for account #{account.id}"
|
||||
Internal::ProcessStaleRedisKeysJob.perform_later(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user