Skip to content

A platform for community discussion. Free, open, simple.

DEV: ensure retries do not re-set attempts=0 (#33365)

Renato Atilio88b37a715afe
diff --git a/lib/freedom_patches/propshaft_patches.rb b/lib/freedom_patches/propshaft_patches.rb
index 24440bb6151..fd0370a745b 100644
--- a/lib/freedom_patches/propshaft_patches.rb
+++ b/lib/freedom_patches/propshaft_patches.rb
@@ -12,18 +12,20 @@ Propshaft::Helper.prepend(
Module.new do
def compute_asset_path(path, options = {})
attempts = 0
- super
- rescue Propshaft::MissingAssetError => e
- if Rails.env.development?
- # Ember-cli might've replaced the assets
- Rails.application.assets.load_path.send(:clear_cache)
- attempts += 1
- retry if attempts < 3
- elsif Rails.env.test?
- # Assets might not be compiled in test mode. Just return a fake path
- "/assets/#{path.sub(".", "-aaaaaaaa.")}"
- else
- raise e
+ begin
+ super
+ rescue Propshaft::MissingAssetError => e
+ if Rails.env.development?
+ # Ember-cli might've replaced the assets
+ Rails.application.assets.load_path.send(:clear_cache)
+ attempts += 1
+ retry if attempts < 3
+ elsif Rails.env.test?
+ # Assets might not be compiled in test mode. Just return a fake path
+ "/assets/#{path.sub(".", "-aaaaaaaa.")}"
+ else
+ raise e
+ end
end
end
end,