1
0
Fork 0
forked from OpenNeo/impress

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:
Emi Matchu 2024-04-16 10:10:28 -07:00
parent 9d8f035360
commit 3ea0842f00

View file

@ -137,6 +137,9 @@ class Pet < ApplicationRecord
end
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])
send_amfphp_request(request).tap do |data|
if data[:name].blank?