Sha256: b2f85dbb26851590c99fc2da6d6770f9f5bc3307d699f5e7e93396088c9b0889

Contents?: true

Size: 331 Bytes

Versions: 6

Compression:

Stored size: 331 Bytes

Contents

class Counter::ReconciliationJob
  # include Sidekiq::Worker

  def perform counter_id
    counter = Counter::Value.find(counter_id)
    changes = Counter::Change.where(counter: counter).pending
    changes.with_lock do
      counter.increment! changes.sum(increment)
      changes.update_all processed: Time.now
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
counterwise-0.1.5 app/jobs/counter/reconciliation_job.rb
counterwise-0.1.4 app/jobs/counter/reconciliation_job.rb
counterwise-0.1.3 app/jobs/counter/reconciliation_job.rb
counterwise-0.1.2 app/jobs/counter/reconciliation_job.rb
counterwise-0.1.1 app/jobs/counter/reconciliation_job.rb
counterwise-0.1.0 app/jobs/counter/reconciliation_job.rb