fix scale reference

This commit is contained in:
r888888888
2017-11-10 15:59:23 -08:00
parent 8458c62e8a
commit 6c4eb62957
2 changed files with 3 additions and 4 deletions

View File

@@ -12,7 +12,6 @@ class PopularSearchService
end
@date = date
@scale = "day"
end
def each_search(limit = 100, &block)
@@ -26,8 +25,8 @@ class PopularSearchService
def fetch_data
dates = date.strftime("%Y-%m-%d")
Cache.get("ps-#{scale}-#{dates}", 1.minute) do
url = "#{Danbooru.config.reportbooru_server}/hits/#{scale}?date=#{dates}"
Cache.get("ps-day-#{dates}", 1.minute) do
url = "#{Danbooru.config.reportbooru_server}/hits/day?date=#{dates}"
response = HTTParty.get(url, Danbooru.config.httparty_options.reverse_merge(timeout: 3))
if response.success?
response = response.body

View File

@@ -10,7 +10,7 @@ class PostViewCountService
end
def fetch_count(post_id)
url = URI.parse("#{Danbooru.config.reportbooru_server}/post_views/#{post_id}?date=#{date}")
url = URI.parse("#{Danbooru.config.reportbooru_server}/post_views/#{post_id}")
response = HTTParty.get(url, Danbooru.config.httparty_options.reverse_merge(timeout: 6))
if response.success?
return JSON.parse(response.body)