From 6e242e82237ad2cf362098f3f42f4a9dd1a4ad27 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 18 Oct 2017 21:46:05 +0200 Subject: Replace old GH importer with the parallel importer --- lib/github/rate_limit.rb | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 lib/github/rate_limit.rb (limited to 'lib/github/rate_limit.rb') diff --git a/lib/github/rate_limit.rb b/lib/github/rate_limit.rb deleted file mode 100644 index 884693d093c..00000000000 --- a/lib/github/rate_limit.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Github - class RateLimit - SAFE_REMAINING_REQUESTS = 100 - SAFE_RESET_TIME = 500 - RATE_LIMIT_URL = '/rate_limit'.freeze - - attr_reader :connection - - def initialize(connection) - @connection = connection - end - - def get - response = connection.get(RATE_LIMIT_URL) - - # GitHub Rate Limit API returns 404 when the rate limit is disabled - return false unless response.status != 404 - - body = Oj.load(response.body, class_cache: false, mode: :compat) - remaining = body.dig('rate', 'remaining').to_i - reset_in = body.dig('rate', 'reset').to_i - exceed = remaining <= SAFE_REMAINING_REQUESTS - - [exceed, reset_in] - end - end -end -- cgit v1.2.1