boston-library / bpldc_authority_api

API for returning authority data and controlled values for BPLDC descriptive metadata
1 stars 0 forks source link

Rails cache storing nil results #123

Open bbarberBPL opened 3 weeks ago

bbarberBPL commented 3 weeks ago

Discovered that the rails cache will store nil results on occasions where the Getty api is down. For example say the Getty api is down when you are querying the tgn 7000874. Geomash will return an empty value due to the the Getty api throwing a 503. However when the site comes back up and you query that value again in geomash it will still return nil. It appears we should set the skip_nils: true option in the Rails.cache.fetch(...) calls in the GeomashController like so.

 Rails.cache.fetch("bpldc:geomash/tgn/#{params[:id]}", skip_nils: true) do
...