This repository has been archived by the owner. It is now read-only.

Faye.ensure_reactor_running! in an initializer #26

Closed
nilbus opened this Issue Jan 16, 2013 · 13 comments

Comments

Projects
None yet
8 participants
@nilbus
Collaborator

nilbus commented Jan 16, 2013

Hi, I noticed your recent change to the README in which you recommended an initializer to run Faye.ensure_reactor_running!. I've actually tried this before with no luck. When I try to start a server in development mode, it just exits during the app startup like so.

$ rails server
=> Booting Thin
=> Rails 4.0.0.beta application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.0 codename Knife)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
Exiting

Have you gotten ensure_reactor_running! working in one of your own apps?

@parndt

This comment has been minimized.

Show comment
Hide comment
@parndt

parndt Apr 28, 2013

@nilbus did you get this working? If not could you please show us your initialiser?

parndt commented Apr 28, 2013

@nilbus did you get this working? If not could you please show us your initialiser?

@nilbus

This comment has been minimized.

Show comment
Hide comment
@nilbus

nilbus Apr 28, 2013

Collaborator

I never did get it working with ensure_reactor_running!, so I just didn't include that line and started the reactor manually when I needed to use it in the Rails console.

Collaborator

nilbus commented Apr 28, 2013

I never did get it working with ensure_reactor_running!, so I just didn't include that line and started the reactor manually when I needed to use it in the Rails console.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Apr 30, 2013

👍 I have the same issue.

ghost commented Apr 30, 2013

👍 I have the same issue.

@jamesotron

This comment has been minimized.

Show comment
Hide comment
@jamesotron

jamesotron Apr 30, 2013

Owner

I wonder, is this specific to Rails 4?

Owner

jamesotron commented Apr 30, 2013

I wonder, is this specific to Rails 4?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Apr 30, 2013

I'm on Rails 3.2.13

ghost commented Apr 30, 2013

I'm on Rails 3.2.13

@film42

This comment has been minimized.

Show comment
Hide comment
@film42

film42 May 1, 2013

Try adding config.threadsafe! to your development.rb and production.rb environments in /config/environments

film42 commented May 1, 2013

Try adding config.threadsafe! to your development.rb and production.rb environments in /config/environments

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost May 1, 2013

No change.

ghost commented May 1, 2013

No change.

@bogdanRada

This comment has been minimized.

Show comment
Hide comment
@bogdanRada

bogdanRada Apr 28, 2014

i have same issue

bogdanRada commented Apr 28, 2014

i have same issue

@itkin

This comment has been minimized.

Show comment
Hide comment
@itkin

itkin commented Jun 6, 2014

+1

@fivetwentysix

This comment has been minimized.

Show comment
Hide comment
@fivetwentysix

fivetwentysix commented Jun 30, 2014

+1

@jamesotron

This comment has been minimized.

Show comment
Hide comment
@jamesotron

jamesotron Dec 31, 2014

Owner

Okay. Here's the horrible way I solved this in MessageRocket:

# config/initializers/faye.rb

def running_as_server?
  Rails.const_defined?(:Server) || defined?(::Rack::Handler::Thin)
end

Rails.application.config.after_initialize do
  unless running_as_server?
    Faye.ensure_reactor_running!
  end
end
Owner

jamesotron commented Dec 31, 2014

Okay. Here's the horrible way I solved this in MessageRocket:

# config/initializers/faye.rb

def running_as_server?
  Rails.const_defined?(:Server) || defined?(::Rack::Handler::Thin)
end

Rails.application.config.after_initialize do
  unless running_as_server?
    Faye.ensure_reactor_running!
  end
end

@jamesotron jamesotron closed this Dec 31, 2014

@nomasprime

This comment has been minimized.

Show comment
Hide comment
@nomasprime

nomasprime Apr 23, 2015

@jamesotron I'm not sure if this is the same issue but I'm getting the error eventmachine not initialized: evma_install_oneshot_timer (RuntimeError) when running Cucumber. I've added the initializer you suggested.

nomasprime commented Apr 23, 2015

@jamesotron I'm not sure if this is the same issue but I'm getting the error eventmachine not initialized: evma_install_oneshot_timer (RuntimeError) when running Cucumber. I've added the initializer you suggested.

@nomasprime

This comment has been minimized.

Show comment
Hide comment
@nomasprime

nomasprime Apr 24, 2015

Never mind, it's because Cucumber doesn't load initialisers. To get it working I just needed to add Faye.ensure_reactor_running! to a support file, e.g., support/faye.rb.

nomasprime commented Apr 24, 2015

Never mind, it's because Cucumber doesn't load initialisers. To get it working I just needed to add Faye.ensure_reactor_running! to a support file, e.g., support/faye.rb.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.