eu_central_bank icon indicating copy to clipboard operation
eu_central_bank copied to clipboard

Uncaught exception: Net::ReadTimeout

Open netwire88 opened this issue 3 years ago • 8 comments

All of a sudden, we are gettin Uncaught exception: Net::ReadTimeout, did the project go down?

netwire88 avatar Jul 09 '22 18:07 netwire88

Same thing here

Splitrox avatar Jul 09 '22 18:07 Splitrox

It looks like https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml is down

netwire88 avatar Jul 09 '22 18:07 netwire88

Maybe there's some way to make sure this gem doesn't crash the whole site?

Splitrox avatar Jul 09 '22 18:07 Splitrox

Until there's a better solution, you can do this

  1. Download latest eurofxref-daily.txt and rename extension to .xml (can't upload XML files to GitHub)
  2. Add it to your /config/initializers or somewhere similar
  3. In money.rb, replace config.default_bank.update_rates with config.default_bank.update_rates(Rails.root.join('config', 'initializers', 'eurofxref-daily.xml'))

At least that'll start your project. I tried the code below in money.rb but the timeout is really long, so it doesn't work

  begin
    config.default_bank.update_rates
  rescue
    config.default_bank.update_rates(Rails.root.join('config', 'initializers', 'eurofxref-daily.xml'))
  end

netwire88 avatar Jul 09 '22 18:07 netwire88

https://github.com/rmustafin/russian_central_bank - This also works, if you're looking for a quick fix.

dobreandl avatar Jul 09 '22 18:07 dobreandl

The feed is not down there has been a CAPTCHA check added:

Security Check Our systems have detected unusual traffic from your computer network. This page checks to see if it is really you sending the requests and not a bot.

Please click here to verify that you are not a bot.

ephraimm avatar Jul 10 '22 09:07 ephraimm

Any alternative sources? Don't really trust a Russian bank.. Could download https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml with curl after filling in the captcha but the eu_central_bank gem fails to do so.

bjer avatar Jul 10 '22 10:07 bjer

try https://github.com/spk/money-open-exchange-rates

ephraimm avatar Jul 10 '22 11:07 ephraimm