about summary refs log tree commit diff
path: root/app/workers/scheduler/doorkeeper_cleanup_scheduler.rb
blob: fec08c6bc38510ec8a71e863bd13c850eb4d7eb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
# frozen_string_literal: true

class Scheduler::DoorkeeperCleanupScheduler
  include Sidekiq::Worker

  sidekiq_options unique: :until_executed

  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