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

class Scheduler::DoorkeeperCleanupScheduler
  include Sidekiq::Worker

  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