Method: Cron::TrimCollection#execute
- Defined in:
- lib/app/jobs/cron/trim_collection.rb
#execute ⇒ Object
Fetch each item and delete it if hasn’t been updated in 30 days
12 13 14 15 16 17 18 19 |
# File 'lib/app/jobs/cron/trim_collection.rb', line 12 def execute count = 0 total = collection.count while count <= total collection.limit(250).skip(count).each { |item| trim_item(item) if archive?(item) } count += 250 end end |