Skip to content

Commit

Permalink
Should work form a cold cache now
Browse files Browse the repository at this point in the history
  • Loading branch information
pikesley committed Dec 31, 2015
1 parent 25258db commit 9a07d83
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/dashboard/fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def self.query
def self.get url
redis = Redis.new
if redis.get url
return redis.get url
return Marshal.load(redis.get url)
end

h = HTTParty.get url, headers: headers, query: query
redis.set url, h.body
redis.set url, Marshal.dump(h.body)
redis.expire url, 3600
h
return Marshal.load(redis.get url)
end

def self.extract_repo url
Expand All @@ -36,11 +36,12 @@ def self.fetch_CSV url
end

def self.fetch_metadata url
JSON.parse get(url)
JSON.parse(get(url))
end

def self.assemble_data url
m = fetch_metadata url

m['data'] = fetch_CSV m['download_url']
m['repo'] = extract_repo m['url']

Expand Down

0 comments on commit 9a07d83

Please sign in to comment.