Permalink
Browse files

added Thin server and refactored the HOBSON_REDIS_SLAVE option to wor…

…k both with vegas and rack
  • Loading branch information...
Jared Grippe authored and deadlyicon committed Jun 7, 2012
1 parent 07f2583 commit c4d5984f6530db3836e3748c11b0a9285892e398
Showing with 17 additions and 1 deletion.
  1. +1 −0 Gemfile
  2. +7 −0 Gemfile.lock
  3. +3 −0 config.ru
  4. +5 −0 lib/hobson/redis.rb
  5. +1 −1 lib/hobson/server.rb
View
@@ -24,4 +24,5 @@ group :development, :test do
gem 'rake'
gem 'rspec'
gem 'resque_unit'
+ gem 'thin'
end
View
@@ -65,8 +65,10 @@ GEM
childprocess (0.3.1)
ffi (~> 1.0.6)
columnize (0.3.6)
+ daemons (1.1.4)
diff-lcs (1.1.3)
erubis (2.7.0)
+ eventmachine (0.12.10)
excon (0.13.4)
ffi (1.0.11)
fog (1.3.1)
@@ -166,6 +168,10 @@ GEM
tilt (~> 1.1, != 1.3.0)
sys-proctable (0.9.1)
systemu (2.4.2)
+ thin (1.3.1)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
thor (0.14.6)
tilt (1.3.3)
uuid (2.3.5)
@@ -187,3 +193,4 @@ DEPENDENCIES
ruby-debug-base19x (~> 0.11.30.pre4)
ruby-debug19
shotgun
+ thin
View
@@ -2,4 +2,7 @@ require 'rubygems'
require 'bundler/setup'
require File.expand_path('../lib/hobson', __FILE__)
+Hobson.log_to_stdout!
+Hobson.use_redis_slave!
+Hobson.log_redis!
run Hobson::Server
View
@@ -62,6 +62,7 @@ def redis_slave
end
def use_redis_slave!
+ return if ENV['HOBSON_REDIS_SLAVE'] == 'false'
begin
redis_slave.balancer.keys
rescue Errno::ECONNREFUSED, RuntimeError
@@ -97,4 +98,8 @@ def enable_redis_benchmarker!
@redis
end
+ def log_redis!
+ root_redis.client.logger = Hobson.logger
+ end
+
end
View
@@ -20,7 +20,7 @@ class Hobson::Server < Sinatra::Base
class Runner < Vegas::Runner
def check_for_running path=nil
super
- Hobson.use_redis_slave! unless ENV['HOBSON_REDIS_SLAVE'] == 'false'
+ Hobson.use_redis_slave!
end
end

0 comments on commit c4d5984

Please sign in to comment.