Skip loading image hashes for "pets" that start with @
This is an optimization on top of 9d8f035
, in which we skip the network
request altogether in this case that we know will and should fail!
This commit is contained in:
parent
9d8f035360
commit
3ea0842f00
1 changed files with 3 additions and 0 deletions
|
@ -137,6 +137,9 @@ class Pet < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.fetch_metadata(name, timeout: 10)
|
def self.fetch_metadata(name, timeout: 10)
|
||||||
|
# If this is an image hash "pet name", it has no metadata.
|
||||||
|
return nil if name.start_with?("@")
|
||||||
|
|
||||||
request = PET_SERVICE.action('getPet').request([name])
|
request = PET_SERVICE.action('getPet').request([name])
|
||||||
send_amfphp_request(request).tap do |data|
|
send_amfphp_request(request).tap do |data|
|
||||||
if data[:name].blank?
|
if data[:name].blank?
|
||||||
|
|
Loading…
Reference in a new issue