Class: InvalidateMultilingualCacheWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- InvalidateMultilingualCacheWorker
- Defined in:
- app/workers/invalidate_multilingual_cache_worker.rb
Overview
Background worker for invalidating multilingual name cache
This worker handles cache invalidation asynchronously to avoid slowing down the main database operations.
Instance Method Summary collapse
-
#perform(model_class_name, model_id) ⇒ void
Process cache invalidation for a specific model instance.
Methods inherited from ApplicationWorker
Instance Method Details
#perform(model_class_name, model_id) ⇒ void
This method returns an undefined value.
Process cache invalidation for a specific model instance
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/workers/invalidate_multilingual_cache_worker.rb', line 14 def perform(model_class_name, model_id) model_class = model_class_name.constantize model_instance = model_class.find_by(id: model_id) # Model might have been deleted, which is fine return unless model_instance # Invalidate cache for this model PartnerService::MultilingualCacheService.invalidate_cache_for_model(model_instance) rescue StandardError => e # Log error but don't retry to avoid infinite loops APMErrorHandler.report('Failed to invalidate multilingual cache in worker', { model_class_name: model_class_name, model_id: model_id, error_message: e., exception: e, }) end |