Merge branch 'master' into cd-v3

This commit is contained in:
carlad 2016-03-18 13:49:22 +01:00
commit 69852d18b3
4 changed files with 12 additions and 8 deletions

View File

@ -50,7 +50,7 @@ GIT
GIT
remote: git://github.com/travis-ci/travis-core.git
revision: 5bff6bf138d31754e38b8c148e56ba8ceab39859
revision: f7b3a76b3f39c28bb5cf7b9dc24acec13908a11a
specs:
travis-core (0.0.1)
actionmailer (~> 3.2.19)
@ -331,7 +331,7 @@ GEM
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.46)
tzinfo (0.3.47)
unicorn (4.8.3)
kgio (~> 2.6)
rack
@ -390,4 +390,4 @@ DEPENDENCIES
yard-sinatra!
BUNDLED WITH
1.10.6
1.11.2

View File

@ -199,8 +199,10 @@ module Travis::Api
Travis::Database.connect
if Travis.config.logs_database
Log.establish_connection 'logs_database'
Log::Part.establish_connection 'logs_database'
pool_size = ENV['DATABASE_POOL_SIZE']
Travis.config.logs_database[:pool] = pool_size.to_i if pool_size
Travis::LogsModel.establish_connection 'logs_database'
end
end

View File

@ -61,7 +61,7 @@ class Rack::Attack
# Ban after: 10 POST requests within 30 seconds
blacklist('spamming with POST requests') do |request|
Rack::Attack::Allow2Ban.filter(request.identifier, maxretry: 10, findtime: 30.seconds, bantime: bantime(1.hour)) do
request.post? and not POST_WHITELISTED.include? '/auth/github'
request.post? and not POST_WHITELISTED.include? request.path
end
end

View File

@ -7,11 +7,13 @@ require 'travis/api/workers/job_cancellation'
require 'travis/api/workers/job_restart'
require 'travis/support/amqp'
pool_size = ENV['SIDEKIQ_DB_POOL_SIZE'] || 5
Travis.config.database[:pool] = pool_size.to_i
Travis.config.logs_database[:pool] = pool_size.to_i
Travis::Database.connect
if Travis.config.logs_database
Log.establish_connection 'logs_database'
Log::Part.establish_connection 'logs_database'
Travis::LogsModel.establish_connection 'logs_database'
end
Travis::Async.enabled = true