Class: SolidCable::TrimJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/solid_cable/trim_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject



5
6
7
8
9
10
11
12
13
# File 'app/jobs/solid_cable/trim_job.rb', line 5

def perform
  return unless trim?

  ::SolidCable::Message.transaction do
    ids = ::SolidCable::Message.trimmable.non_blocking_lock.
          limit(trim_batch_size).pluck(:id)
    ::SolidCable::Message.where(id: ids).delete_all
  end
end