shrinerb / shrine

File Attachment toolkit for Ruby applications

Home Page:https://shrinerb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support retries with remote_url

jeremylynch opened this issue · comments

We are successfully using the remote_url, however occasionally running into "remote file not found" errors.

Is there a way we could pass a retries variable to the downloader? Or alternatively what is the recommended way to handle retries here?

You can override the :downloader option to add your retry logic:

Shrine.plugin :remote_url, downloader: -> (url, **options) do
  # example using the retriable gem – https://github.com/kamui/retriable
  Retriable.retriable { Down.download(url, **options) }
end