lib/models/music_brainz.rb in musicbrainz-0.3.1 vs lib/models/music_brainz.rb in musicbrainz-0.4.0
- old
+ new
@@ -13,15 +13,15 @@
sleep 1.1 - (Time.now.to_f - self.last_query_time) if Time.now.to_f - self.last_query_time < 1.1
response = nil
5.times do
begin
response = open(url, "User-Agent" => "gem musicbrainz (https://github.com/magnolia-fan/musicbrainz) @ " + Socket.gethostname)
+ self.last_query_time = Time.now.to_f
rescue => e
p "MusicBrainz: 503"
end
break unless response.nil?
end
- self.last_query_time = Time.now.to_f
response
end
def self.discography mbid
artist = MusicBrainz::Artist.find(mbid)