Module: PartnerService::Reservations::Exports::ProgressTracker::ErrorHandler
- Defined in:
- app/services/partner_service/reservations/exports/progress_tracker.rb
Overview
Error handling with retry logic
Instance Method Summary collapse
-
#handle_retryable_error(error_category, exception, retry_count = 0, max_retries = 3) ⇒ Boolean
Handle retryable errors with exponential backoff.
Instance Method Details
#handle_retryable_error(error_category, exception, retry_count = 0, max_retries = 3) ⇒ Boolean
Handle retryable errors with exponential backoff
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'app/services/partner_service/reservations/exports/progress_tracker.rb', line 220 def handle_retryable_error(error_category, exception, retry_count = 0, max_retries = 3) if retry_count < max_retries && retryable_error?(exception) # Calculate backoff delay delay = calculate_backoff_delay(retry_count) @export_tracker&.handle_error( error_category, "Retrying after error (attempt #{retry_count + 1}/#{max_retries + 1}): #{exception.}", exception, retry_count + 1, ) # Sleep for backoff delay sleep(delay) if delay > 0 true # Indicate should retry else @export_tracker&.handle_error( error_category, "Max retries exceeded: #{exception.}", exception, retry_count, ) false # Indicate should not retry end end |