Class: Restaurants::ReviewsCountWorker

Inherits:
ApplicationWorker show all
Defined in:
app/workers/restaurants/reviews_count_worker.rb

Overview

Worker responsible for updating restaurant review counts after a delay to prevent race conditions and ensure data consistency.

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#perform(model_class, model_id) ⇒ Object

Update the review count for a restaurant

Parameters:

  • model_class (String)

    The class name (e.g., 'Review')

  • model_id (Integer)

    The ID of the model instance



11
12
13
14
15
# File 'app/workers/restaurants/reviews_count_worker.rb', line 11

def perform(model_class, model_id)
  ElasticAPM.with_span('Restaurant reviews count update', 'app') do
    Restaurant.update_reviews_count(model_class, model_id)
  end
end