Skip to content

Commit

Permalink
small code-style-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Adler committed Jul 20, 2017
1 parent 3923fe9 commit 2e5a48c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/giant_bomb_api/collection_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ def rate_limit(should_rate_limit, rate_per_hour, &block)
request_time = t2 - t1
time_to_one_hour = (started_at + 1.hour) - t2
remaining_requests = rate_per_hour - num_of_requests
min_time_per_request = if remaining_requests == 0
time_to_one_hour
else
time_to_one_hour / remaining_requests
end

min_time_per_request = remaining_requests.zero? ? time_to_one_hour : time_to_one_hour / remaining_requests
sleep(min_time_per_request - request_time) if request_time < min_time_per_request
end
end
Expand Down

0 comments on commit 2e5a48c

Please sign in to comment.