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 '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-support', github: 'travis-ci/travis-support'
|
||||||
gem 'travis-amqp', github: 'travis-ci/travis-amqp'
|
gem 'travis-amqp', github: 'travis-ci/travis-amqp'
|
||||||
gem 'travis-config', '~> 0.1.0'
|
gem 'travis-config', '~> 0.1.0'
|
||||||
|
|
|
@ -48,7 +48,8 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/travis-ci/travis-core.git
|
remote: git://github.com/travis-ci/travis-core.git
|
||||||
revision: 9978518236afb520c8fff68bebe7beb62f8ad776
|
revision: 76ddca556f0eb9f40daa50789223db9e18174d46
|
||||||
|
branch: cd-ar-rate-limit-on-travis-config
|
||||||
specs:
|
specs:
|
||||||
travis-core (0.0.1)
|
travis-core (0.0.1)
|
||||||
actionmailer (~> 3.2.19)
|
actionmailer (~> 3.2.19)
|
||||||
|
@ -388,6 +389,3 @@ DEPENDENCIES
|
||||||
travis-yaml!
|
travis-yaml!
|
||||||
unicorn
|
unicorn
|
||||||
yard-sinatra!
|
yard-sinatra!
|
||||||
|
|
||||||
BUNDLED WITH
|
|
||||||
1.12.0.pre.1
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
module Travis::API::V3
|
module Travis::API::V3
|
||||||
class Services::Requests::Create < Service
|
class Services::Requests::Create < Service
|
||||||
TIME_FRAME = 1.hour
|
TIME_FRAME = 1.hour
|
||||||
private_constant :TIME_FRAME
|
LIMIT = 10
|
||||||
|
private_constant :TIME_FRAME, :LIMIT
|
||||||
|
|
||||||
result_type :request
|
result_type :request
|
||||||
params "request", "user", :config, :message, :branch, :token
|
params "request", "user", :config, :message, :branch, :token
|
||||||
|
@ -23,9 +24,9 @@ module Travis::API::V3
|
||||||
|
|
||||||
def limit(repository)
|
def limit(repository)
|
||||||
if repository.settings.nil?
|
if repository.settings.nil?
|
||||||
Travis.config.requests_create_api_limit
|
Travis.config.requests_create_api_limit || LIMIT
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user