Don't load octopus if there is no need

This commit is contained in:
Piotr Sarnacki 2013-05-05 00:17:44 +02:00
parent be627a68af
commit 935288e8e9
3 changed files with 7 additions and 3 deletions

View File

@ -23,7 +23,7 @@ gem 'dalli'
gem 'pry'
gem 'metriks', '0.9.9.2'
gem 'ar-octopus', github: 'travis-ci/octopus', require: 'octopus'
gem 'ar-octopus', github: 'travis-ci/octopus', require: nil
group :test do
gem 'rspec', '~> 2.11'

View File

@ -4,7 +4,6 @@ require 'rack'
require 'rack/protection'
require 'rack/contrib'
require 'rack/cache'
require 'octopus'
require 'active_record'
require 'redis'
require 'gh'
@ -143,6 +142,7 @@ module Travis::Api
Travis::Database.connect
return unless Travis.config.use_database_follower?
require 'octopus'
if Travis.env == 'production' || Travis.env == 'staging'
puts "Setting up the DB follower as a read slave"

View File

@ -4,7 +4,11 @@ class Travis::Api::App
module Helpers
module DbFollower
def prefer_follower
Octopus.using(:follower) do
if Travis.config.use_database_follower?
Octopus.using(:follower) do
yield
end
else
yield
end
end