Add new cron job for clearing expired source tokens. Closes #121.
This commit is contained in:
parent
6d2af56397
commit
cfdc6b2d0d
1 changed files with 8 additions and 0 deletions
|
@ -100,4 +100,12 @@ module ScheduledJobs
|
|||
end
|
||||
end
|
||||
|
||||
def self.delete_expired_source_tokens
|
||||
return Enumerator.new do |yielder|
|
||||
yielder << lambda do
|
||||
tokens_deleted = SourceToken.where("expiration > ?", DateTime.now - 1.day).delete_all
|
||||
"Deleted #{tokens_deleted} source tokens"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue