lib/fbe/octo.rb in fbe-0.0.32 vs lib/fbe/octo.rb in fbe-0.0.33
- old
+ new
@@ -28,10 +28,11 @@
require 'octokit'
require 'verbose'
require 'faraday/http_cache'
require 'faraday/retry'
require_relative '../fbe'
+require_relative 'middleware/quota'
def Fbe.octo(options: $options, global: $global, loog: $loog)
raise 'The $global is not set' if global.nil?
global[:octo] ||= begin
if options.testing.nil?
@@ -72,9 +73,14 @@
],
max: 4,
interval: ENV['RACK_ENV'] == 'test' ? 0.01 : 4,
methods: [:get],
backoff_factor: 2
+ )
+ builder.use(
+ Fbe::Middleware::Quota,
+ logger: loog,
+ pause: options.github_api_pause
)
builder.use(Faraday::HttpCache, serializer: Marshal, shared_cache: false, logger: Loog::NULL)
builder.use(Octokit::Response::RaiseError)
builder.use(Faraday::Response::Logger, Loog::NULL)
builder.adapter(Faraday.default_adapter)