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

class Scheduler::DoorkeeperCleanupScheduler
  include Sidekiq::Worker

  sidekiq_options lock: :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
    SystemKey.expired.delete_all
  end
end