Class: Users::UpdateMetaWorker

Inherits:
ApplicationWorker show all
Defined in:
app/workers/users/update_meta_worker.rb

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#perform(user_id) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'app/workers/users/update_meta_worker.rb', line 4

def perform(user_id)
  user = User.find_by id: user_id
  return if user.blank?

  user.usage = user.reservations.reached_goal_scope.count

  Retriable.retriable on: [ActiveRecord::Deadlocked], tries: 10 do
    user.save validate: false
  end
end