Use LIMIT constant as a backup limit number
This commit is contained in:
parent
4556130acb
commit
679bbd7901
2
Gemfile
2
Gemfile
|
@ -5,7 +5,7 @@ ruby '2.1.7' if ENV.key?('DYNO')
|
|||
|
||||
gem 's3', github: 'travis-ci/s3'
|
||||
|
||||
gem 'travis-core', github: 'travis-ci/travis-core'
|
||||
gem 'travis-core', github: 'travis-ci/travis-core', branch: 'cd-ar-rate-limit-on-travis-config'
|
||||
gem 'travis-support', github: 'travis-ci/travis-support'
|
||||
gem 'travis-amqp', github: 'travis-ci/travis-amqp'
|
||||
gem 'travis-config', '~> 0.1.0'
|
||||
|
|
|
@ -48,7 +48,8 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/travis-ci/travis-core.git
|
||||
revision: 9978518236afb520c8fff68bebe7beb62f8ad776
|
||||
revision: 76ddca556f0eb9f40daa50789223db9e18174d46
|
||||
branch: cd-ar-rate-limit-on-travis-config
|
||||
specs:
|
||||
travis-core (0.0.1)
|
||||
actionmailer (~> 3.2.19)
|
||||
|
@ -388,6 +389,3 @@ DEPENDENCIES
|
|||
travis-yaml!
|
||||
unicorn
|
||||
yard-sinatra!
|
||||
|
||||
BUNDLED WITH
|
||||
1.12.0.pre.1
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
module Travis::API::V3
|
||||
class Services::Requests::Create < Service
|
||||
TIME_FRAME = 1.hour
|
||||
private_constant :TIME_FRAME
|
||||
LIMIT = 10
|
||||
private_constant :TIME_FRAME, :LIMIT
|
||||
|
||||
result_type :request
|
||||
params "request", "user", :config, :message, :branch, :token
|
||||
|
@ -23,9 +24,9 @@ module Travis::API::V3
|
|||
|
||||
def limit(repository)
|
||||
if repository.settings.nil?
|
||||
Travis.config.requests_create_api_limit
|
||||
Travis.config.requests_create_api_limit || LIMIT
|
||||
else
|
||||
repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit
|
||||
repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user