doorkeeper_cleanup_scheduler.rb 377 B

123456789101112
  1. # frozen_string_literal: true
  2. class Scheduler::DoorkeeperCleanupScheduler
  3. include Sidekiq::Worker
  4. sidekiq_options unique: :until_executed, retry: 0
  5. def perform
  6. Doorkeeper::AccessToken.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all
  7. Doorkeeper::AccessGrant.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all
  8. end
  9. end