From 6d2af5639756f943f23a89b1de3f101342cb607a Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Tue, 11 Dec 2018 14:06:50 -0600 Subject: [PATCH 1/2] Remove unneed whitespace --- lib/scheduled_jobs.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/scheduled_jobs.rb b/lib/scheduled_jobs.rb index 247f3f98..35aac082 100644 --- a/lib/scheduled_jobs.rb +++ b/lib/scheduled_jobs.rb @@ -85,7 +85,6 @@ module ScheduledJobs end end - def self.update_pending_payouts return Enumerator.new do |yielder| Payout.pending.includes(:nonprofit).each do |p| From cfdc6b2d0ddb0bb2c3806f9e39ccd6d2be784146 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Tue, 11 Dec 2018 14:44:31 -0600 Subject: [PATCH 2/2] Add new cron job for clearing expired source tokens. Closes #121. --- lib/scheduled_jobs.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/scheduled_jobs.rb b/lib/scheduled_jobs.rb index 35aac082..3d4f992d 100644 --- a/lib/scheduled_jobs.rb +++ b/lib/scheduled_jobs.rb @@ -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