From 1fcd758bd457617e71b4eb3e2383cac1b8acc5ac Mon Sep 17 00:00:00 2001
From: maxwell <maxwell@joindiaspora.com>
Date: Sat, 19 Jun 2010 15:07:12 -0700
Subject: [PATCH] removed the mutex, added rack fiber pool.  this thing screams

---
 Gemfile                            | 2 +-
 config.ru                          | 1 +
 config/environments/development.rb | 1 +
 config/environments/production.rb  | 2 ++
 config/environments/test.rb        | 2 ++
 lib/message_handler.rb             | 1 -
 6 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Gemfile b/Gemfile
index 69d099589c..bdfc1c385a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,7 +10,7 @@ gem "bson_ext", "1.0.1"
 gem "haml"
 gem "devise", :git => "git://github.com/plataformatec/devise.git"
 gem 'roxml', :git => "git://github.com/Empact/roxml.git"
-
+gem 'rack-fiber_pool', :require => 'rack/fiber_pool'
 
 group :test do
 	gem 'rspec', '>= 2.0.0.beta.12'
diff --git a/config.ru b/config.ru
index fbe82a3fcb..58f9e64a89 100644
--- a/config.ru
+++ b/config.ru
@@ -1,4 +1,5 @@
 # This file is used by Rack-based servers to start the application.
 
 require ::File.expand_path('../config/environment',  __FILE__)
+use Rack::FiberPool
 run Diaspora::Application
diff --git a/config/environments/development.rb b/config/environments/development.rb
index dfb1f2e189..45d756166a 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -16,4 +16,5 @@ Diaspora::Application.configure do
 
   # Don't care if the mailer can't send
   config.action_mailer.raise_delivery_errors = false
+  config.threadsafe!
 end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index e47cce4591..b9b2fefe7f 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -43,4 +43,6 @@ Diaspora::Application.configure do
   # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
   # the I18n.default_locale when a translation can not be found)
   config.i18n.fallbacks = true
+  config.threadsafe!
+  
 end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 1a91344077..4edb0fb454 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -24,6 +24,8 @@ Diaspora::Application.configure do
   # The :test delivery method accumulates sent emails in the
   # ActionMailer::Base.deliveries array.
   config.action_mailer.delivery_method = :test
+  config.threadsafe!
+  
 
   # Use SQL instead of Active Record's schema dumper when creating the test database.
   # This is necessary if your schema can't be completely dumped by the schema dumper,
diff --git a/lib/message_handler.rb b/lib/message_handler.rb
index da12fd2e8c..7d75ce08c1 100644
--- a/lib/message_handler.rb
+++ b/lib/message_handler.rb
@@ -24,7 +24,6 @@ class MessageHandler
     @queue.pop{ |query|
       case query.type
       when :post
-        puts Addressable::URI::parse(query.destination).inspect
         http = EventMachine::HttpRequest.new(query.destination).post :timeout => TIMEOUT, :body =>{:xml =>  query.body}
         http.callback { process}
       when :get
-- 
GitLab