Merge pull request #125 from houdiniproject/add_source_token_expiration_job

Add source token expiration job
This commit is contained in:
Eric Schultz 2018-12-11 15:05:23 -06:00 committed by GitHub
commit 33a280a0d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -85,7 +85,6 @@ module ScheduledJobs
end end
end end
def self.update_pending_payouts def self.update_pending_payouts
return Enumerator.new do |yielder| return Enumerator.new do |yielder|
Payout.pending.includes(:nonprofit).each do |p| Payout.pending.includes(:nonprofit).each do |p|
@ -101,4 +100,12 @@ module ScheduledJobs
end end
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 end