Class: FirebaseCleanupWorker
- Inherits:
-
ApplicationWorker
- Object
- ApplicationWorker
- FirebaseCleanupWorker
- Includes:
- ElasticAPM::SpanHelpers
- Defined in:
- app/workers/firebase_cleanup_worker.rb
Overview
Worker to handle Firebase reservation cleanup in batches
Phase 1: Specific IDs cleanup only (for safety)
-
REQUIRES array of reservation IDs to delete
-
No automatic date-based cleanup to prevent accidental deletion
-
One-time execution per batch (no self-enqueueing)
Usage:
# Delete specific reservation IDs (REQUIRED parameter)
FirebaseCleanupWorker.perform_async([12345, 67890, 11111])
# Will raise error if called without IDs
FirebaseCleanupWorker.perform_async # => ArgumentError
Instance Method Summary collapse
-
#perform(reservation_ids) ⇒ Object
Perform Firebase cleanup for specific reservation IDs REQUIRED: reservation_ids parameter must be provided to avoid accidental deletion.
Methods inherited from ApplicationWorker
Instance Method Details
#perform(reservation_ids) ⇒ Object
Perform Firebase cleanup for specific reservation IDs REQUIRED: reservation_ids parameter must be provided to avoid accidental deletion
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/workers/firebase_cleanup_worker.rb', line 28 def perform(reservation_ids) if reservation_ids.blank? error_msg = 'reservation_ids parameter is required to avoid accidental data deletion' BUSINESS_LOGGER.error( error_msg, { worker: 'FirebaseCleanupWorker', mode: 'specific_ids', error: 'missing_required_parameter', }, ) raise ArgumentError, error_msg end # Delete specific reservation IDs perform_specific_ids_cleanup(reservation_ids) rescue StandardError => e APMErrorHandler.report( e, reservation_ids: reservation_ids.first(10), # Log first 10 IDs for debugging worker: 'FirebaseCleanupWorker', ) raise end |