lib/plezi/activation.rb in plezi-0.14.9 vs lib/plezi/activation.rb in plezi-0.15.0
- old
+ new
@@ -1,7 +1,6 @@
-require 'plezi/websockets/message_dispatch' unless defined?(::Plezi::Base::MessageDispatch)
-
+require 'uri' unless defined?(::URI)
module Plezi
protected
@plezi_finalize = nil
def plezi_finalize
@@ -12,27 +11,21 @@
end
@plezi_initialize = nil
def self.plezi_initialize
if @plezi_initialize.nil?
@plezi_initialize = true
- self.hash_proc_4symstr # crerate the Proc object used for request params
+ self.hash_proc_4symstr # creates the Proc object used for request params
@plezi_autostart = true if @plezi_autostart.nil?
- if ENV['PL_REDIS_URL'.freeze] && !defined?(::Redis)
- puts "WARNNING: auto-scaling with redis is set using ENV['PL_REDIS_URL'.freeze]\r\n but the Redis gem isn't included! - SCALING IS IGNORED!"
- ::Iodine.processes ||= 1
- elsif !ENV['PL_REDIS_URL'.freeze]
- ::Iodine.processes ||= 1
+ Iodine.patch_rack
+ if((ENV['PL_REDIS_URL'.freeze] ||= ENV["REDIS_URL"]))
+ uri = URI(ENV['PL_REDIS_URL'.freeze])
+ Iodine.default_pubsub = Iodine::PubSub::RedisEngine.new(uri.host, uri.port, 0, uri.password)
end
- ::Iodine.processes ||= 4
at_exit do
next if @plezi_autostart == false
::Iodine::Rack.app = ::Plezi.app
::Iodine.start
end
end
true
end
end
-
-::Iodine.threads ||= 16
-# ::Iodine.processes ||= (ENV['PL_REDIS_URL'.freeze] ? 4 : 1)
-::Iodine.run { ::Plezi::Base::MessageDispatch._init }