forked from OpenNeo/impress
move async behavior to development_async environment
This commit is contained in:
parent
e40d4601d8
commit
1a6bbd8dbd
6 changed files with 50 additions and 23 deletions
18
Gemfile
18
Gemfile
|
@ -3,6 +3,15 @@ source 'http://rubygems.org'
|
|||
gem 'rails', '3.0.0'
|
||||
#gem 'sqlite3-ruby', '~> 1.3.1', :require => 'sqlite3'
|
||||
|
||||
gem 'compass', '~> 0.10.1'
|
||||
gem 'haml', '~> 3.0.18'
|
||||
gem 'rdiscount', '~> 1.6.5'
|
||||
gem 'RocketAMF', '~> 0.2.1'
|
||||
gem 'will_paginate', '~> 3.0.pre2'
|
||||
|
||||
gem 'jammit', '~> 0.5.3'
|
||||
|
||||
group :development_async, :production do
|
||||
# async wrappers
|
||||
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git'
|
||||
gem 'rack-fiber_pool', :require => 'rack/fiber_pool'
|
||||
|
@ -18,14 +27,7 @@ gem 'em-mysqlplus', :git => 'git://github.com/igrigorik/em-mysqlplus.git', :r
|
|||
# async http requires
|
||||
gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http'
|
||||
gem 'addressable', :require => 'addressable/uri'
|
||||
|
||||
gem 'compass', '~> 0.10.1'
|
||||
gem 'haml', '~> 3.0.18'
|
||||
gem 'rdiscount', '~> 1.6.5'
|
||||
gem 'RocketAMF', '~> 0.2.1'
|
||||
gem 'will_paginate', '~> 3.0.pre2'
|
||||
|
||||
gem 'jammit', '~> 0.5.3'
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem 'factory_girl_rails', '~> 1.0'
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
require ::File.expand_path('../config/environment', __FILE__)
|
||||
|
||||
use Rack::FiberPool
|
||||
use Rack::FiberPool if defined?(USE_FIBER_POOL) && USE_FIBER_POOL
|
||||
run OpenneoImpressItems::Application
|
||||
|
|
|
@ -18,10 +18,6 @@ OpenneoImpressItems::Application.configure do
|
|||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
config.serve_static_assets = true
|
||||
|
||||
config.threadsafe!
|
||||
end
|
||||
|
||||
RemoteImpressHost = 'beta.impress.openneo.net'
|
||||
|
|
27
config/environments/development_async.rb
Normal file
27
config/environments/development_async.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
OpenneoImpressItems::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/environment.rb
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# since you don't have to restart the webserver when you make code changes.
|
||||
config.cache_classes = false
|
||||
|
||||
# Log error messages when you accidentally call methods on nil.
|
||||
config.whiny_nils = true
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_view.debug_rjs = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
config.threadsafe!
|
||||
end
|
||||
|
||||
RemoteImpressHost = 'beta.impress.openneo.net'
|
||||
|
||||
USE_FIBER_POOL = true
|
|
@ -29,7 +29,7 @@ OpenneoImpressItems::Application.configure do
|
|||
|
||||
# Disable Rails's static asset server
|
||||
# In production, Apache or nginx will already do this
|
||||
config.serve_static_assets = true
|
||||
# config.serve_static_assets = true
|
||||
|
||||
# Enable serving of images, stylesheets, and javascripts from an asset server
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
|
@ -44,3 +44,5 @@ OpenneoImpressItems::Application.configure do
|
|||
end
|
||||
|
||||
RemoteImpressHost = 'impress.openneo.net'
|
||||
|
||||
USE_FIBER_POOL = true
|
||||
|
|
|
@ -12,7 +12,7 @@ module RocketAMF
|
|||
def fetch
|
||||
uri = @service.gateway.uri
|
||||
data = envelope.serialize
|
||||
if EventMachine.reactor_running?
|
||||
if defined?(EventMachine) && EventMachine.reactor_running?
|
||||
req = EM::HttpRequest.new(uri).post :body => data
|
||||
response_body = req.response
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue