class Doorkeeper::Orm::ActiveRecord::StaleRecordsCleaner
Helper class to clear stale and non-active tokens and grants. Used by Doorkeeper
Rake
tasks.
Public Class Methods
Source
# File lib/doorkeeper/orm/active_record/stale_records_cleaner.rb, line 10 def initialize(base_scope) @base_scope = base_scope end
Public Instance Methods
Source
# File lib/doorkeeper/orm/active_record/stale_records_cleaner.rb, line 25 def clean_expired(ttl) table = @base_scope.arel_table @base_scope .where.not(expires_in: nil) .where(table[:created_at].lt(Time.current - ttl)) .in_batches(&:delete_all) end
Clears expired records
Source
# File lib/doorkeeper/orm/active_record/stale_records_cleaner.rb, line 15 def clean_revoked table = @base_scope.arel_table @base_scope .where.not(revoked_at: nil) .where(table[:revoked_at].lt(Time.current)) .in_batches(&:delete_all) end
Clears revoked records