Skip to content

Commit 6a9142e

Browse files
committed
Restored the clear expired sessions task as a sidekiq job
1 parent 7d3755a commit 6a9142e

File tree

3 files changed

+10
-51
lines changed

3 files changed

+10
-51
lines changed

app/clock.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
end
2727

2828
every(1.day, 'cleanup:protips:associate_zombie_upvotes', at: '03:30') { CleanupProtipsAssociateZombieUpvotesJob.perform_async }
29-
every(1.day, 'clear_expired_sessions', at: '00:00') {}
29+
every(1.day, 'clear_expired_sessions', at: '06:00') { ClearExpiredSessionsJob.perform_async }
3030
every(1.day, 'facts:system', at: '00:00') {}
3131
every(1.day, 'protips:recalculate_scores', at: '00:00') {}
3232
every(1.day, 'search:sync', at: '00:00') {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class ClearExpiredSessionsJob
2+
include Sidekiq::Worker
3+
4+
sidekiq_options queue: :low
5+
6+
def perform
7+
ActiveRecord::SessionStore::Session.delete_all(["updated_at < ?", 7.days.ago])
8+
end
9+
end

lib/tasks/db.rake

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)