summaryrefslogtreecommitdiff
path: root/lib/sampling/riot_api.rb
diff options
context:
space:
mode:
authornfoy <nfoy@purdue.edu>2014-04-28 20:39:29 -0400
committernfoy <nfoy@purdue.edu>2014-04-28 20:39:29 -0400
commitd2c700eb31e6a81cb5befe2f9dc57afa7fe8dc91 (patch)
tree7a3447dff226b45bee3d60762fa4138f04327b14 /lib/sampling/riot_api.rb
parent25ff0e9d1a22cbfa65fbece800d00d7cae0c0d8e (diff)
Luke did some shit I dont know if he finished
Diffstat (limited to 'lib/sampling/riot_api.rb')
-rw-r--r--lib/sampling/riot_api.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/sampling/riot_api.rb b/lib/sampling/riot_api.rb
index 7e14551..7d75475 100644
--- a/lib/sampling/riot_api.rb
+++ b/lib/sampling/riot_api.rb
@@ -39,7 +39,11 @@ module Sampling
class Job < ThrottledApiRequest
def initialize(request, args={})
@url = Sampling::RiotApi::url(request, args)
- super(api_name, 10.seconds, 10)
+ limits = [
+ {:unit_time => 10.seconds, :requests_per => 10},
+ {:unit_time => 10.minutes, :requests_per => 500},
+ ]
+ super(api_name, limits)
end
def perform
@@ -153,7 +157,8 @@ module Sampling
def start
@match.teams.each do |team|
team.users.each do |user|
- Delayed::Job.enqueue(MatchJob.new(user, @match, @match.stats_from(self.class), nil), :queue => api_name)
+ #For demo purposes, we are hard coding in a league of legends game id.
+ Delayed::Job.enqueue(MatchJob.new(user, @match, @match.stats_from(self.class), 1362730546), :queue => api_name)
end
end
end
@@ -177,7 +182,7 @@ module Sampling
Delayed::Job.enqueue(MatchJob.new(user, match, data["games"][0]["gameId"]), :queue => api_name)
else
if @last_game_id == data["games"][0]["gameId"]
- # TODO: perhaps insert a delay here?
+ sleep(4.minutes)
Delayed::Job.enqueue(MatchJob.new(user, match, @last_game_id), :queue => api_name)
else
@stats.each do |stat|