lib/entrez/query_limit.rb
def respect_query_limit
      now = Time.now.to_f
      three_requests_ago = request_times[-3]
      request_times << now
      return unless three_requests_ago
      time_for_last_3_requeests = now - three_requests_ago
      enough_time_has_passed = time_for_last_3_requeests >= 1.0
      unless enough_time_has_passed
        sleep_time = 1 - time_for_last_3_requeests
        STDERR.puts "sleeping #{sleep_time}"
        sleep(sleep_time)
      end
    end
def respect_query_limit
      now = Time.now.to_f
      three_requests_ago = request_times[-3]
      request_times << now
      return unless three_requests_ago
      time_for_last_3_requeests = now - three_requests_ago
      enough_time_has_passed = time_for_last_3_requeests >= 1.0
      unless enough_time_has_passed
        sleep_time = 1 - time_for_last_3_requeests
        STDERR.puts "sleeping #{sleep_time}"
        sleep(sleep_time)
      end
    end
NCBI does not allow more than 3 requests per second.
 If the last 3 requests happened within the last 1 second,
 sleep for enough time to let a full 1 second pass before the next request.
 Add current time to queue.