Skip to content

Commit 43f27d1

Browse files
committed
Trimming sessions in batches
1 parent 734c38f commit 43f27d1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/tasks/database.rake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace 'db:sessions' do
1616
cutoff_period = (ENV['SESSION_DAYS_TRIM_THRESHOLD'] || 30).to_i.days.ago
1717
ActiveRecord::SessionStore::Session.
1818
where("updated_at < ?", cutoff_period).
19+
in_batches.
1920
delete_all
2021
end
2122

0 commit comments

Comments
 (0)