Skip to content

Commit f18f1bf

Browse files
committed
fix: disable retries for WebP and image processing errors
- added `PERMANENT_REASONS` constant in `src/background_tile_loader.rb` - updated `BackgroundTileLoader#classify_error`: `webp_conversion_error` and `image_processing_error` are now forced to `:permanent` before `TRANSIENT_STATUS_CODES` checks - kept existing retry behavior for network and other transient HTTP failures unchanged
1 parent 076c7af commit f18f1bf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/background_tile_loader.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class BackgroundTileLoader
1717
TRANSIENT_STATUS_CODES = [429, 500, 502, 503, 504].freeze
1818
CRITICAL_STATUS_CODES = [401, 403].freeze
1919
PERMANENT_STATUS_CODES = [204, 400, 404].freeze
20+
PERMANENT_REASONS = %w[
21+
webp_conversion_error
22+
image_processing_error
23+
].freeze
2024

2125
def initialize(route, source_name)
2226
@route = route
@@ -1012,6 +1016,7 @@ def handle_source_unavailable(x, y, z, attempts)
10121016
end
10131017

10141018
def classify_error(status, reason)
1019+
return :permanent if PERMANENT_REASONS.include?(reason.to_s)
10151020
return :critical if CRITICAL_STATUS_CODES.include?(status)
10161021
return :permanent if PERMANENT_STATUS_CODES.include?(status)
10171022
return :permanent if reason&.start_with?('permanent:')

0 commit comments

Comments
 (0)