about summary refs log tree commit diff
path: root/app/workers/scheduler
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-05-22 13:36:21 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-05-22 19:36:21 +0200
commitec34ec63b195d94a1ee43ac584ff74d84822222f (patch)
treef135626f8a790e78fc86a2102d58f5f433e2b080 /app/workers/scheduler
parent4a4733b397c9a5d3a69d7b2156f4f8aa62ff0c32 (diff)
Specs for cleanup workers (#3235)
* Add spec files for feed and media cleanup workers

* Add coverage for feed and media cleanup schedulers

* Clean up feed and media cleanup workers
Diffstat (limited to 'app/workers/scheduler')
-rw-r--r--app/workers/scheduler/feed_cleanup_scheduler.rb2
-rw-r--r--app/workers/scheduler/media_cleanup_scheduler.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/workers/scheduler/feed_cleanup_scheduler.rb b/app/workers/scheduler/feed_cleanup_scheduler.rb
index c7df363a4..402eed7c6 100644
--- a/app/workers/scheduler/feed_cleanup_scheduler.rb
+++ b/app/workers/scheduler/feed_cleanup_scheduler.rb
@@ -17,7 +17,7 @@ class Scheduler::FeedCleanupScheduler
   private
 
   def inactive_users
-    User.confirmed.where('current_sign_in_at < ?', 14.days.ago)
+    User.confirmed.inactive
   end
 
   def redis
diff --git a/app/workers/scheduler/media_cleanup_scheduler.rb b/app/workers/scheduler/media_cleanup_scheduler.rb
index 885ee9afc..a95f512be 100644
--- a/app/workers/scheduler/media_cleanup_scheduler.rb
+++ b/app/workers/scheduler/media_cleanup_scheduler.rb
@@ -12,6 +12,6 @@ class Scheduler::MediaCleanupScheduler
   private
 
   def unattached_media
-    MediaAttachment.reorder(nil).where(status_id: nil).where('created_at < ?', 1.day.ago)
+    MediaAttachment.reorder(nil).unattached.where('created_at < ?', 1.day.ago)
   end
 end