about summary refs log blame commit diff
path: root/app/workers/scheduler/doorkeeper_cleanup_scheduler.rb
blob: e5e5f6bc42fcb035a3453442180d3529be3875fa (plain) (tree)
1
2
3
4
5
6
7
                             


                                           
                                                   
 



                                                                                                  
# frozen_string_literal: true

class Scheduler::DoorkeeperCleanupScheduler
  include Sidekiq::Worker

  sidekiq_options unique: :until_executed, retry: 0

  def perform
    Doorkeeper::AccessToken.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all
    Doorkeeper::AccessGrant.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all
  end
end