Merge pull request #125 from houdiniproject/add_source_token_expiration_job
Add source token expiration job
This commit is contained in:
commit
33a280a0d1
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue