Skip to content
This repository has been archived by the owner on May 25, 2018. It is now read-only.

rake aborted! eventmachine not initialized: evma_install_oneshot_timer #73

Open
deemytch opened this issue Mar 13, 2015 · 7 comments
Open

Comments

@deemytch
Copy link

Rails 4.2.0
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
thin 1.6.3

I got this error when creating/saving observed model in rake db:seed or in console. I have this in config/initializers/faye.rb
I don't know where else do I need to check.

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

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

and in config/application.rb

config.middleware.delete Rack::Lock
config.middleware.use FayeRails::Middleware, mount: '/quick', :timeout => 25 do
    map '/registerapp/**' => ManageTabletsController
      # ... more mappings
      map :default => :block
    end

and in ManageTabletsController

class ManageTabletsController < FayeRails::Controller
  observe Device, :after_save do |r|
    #some code
  end
end
@nomasprime
Copy link

I'm having a similar problem with Rspec, I'm stumped too. Is @jamesotron out there?

@nomasprime
Copy link

https://github.com/stevegraham/em-rspec makes this error go away.

@jimsynz
Copy link
Owner

jimsynz commented Apr 27, 2015

I think that recent versions of rspec-rails aren't running rails initializers on startup - I'd need to confirm that with @JonRowe however.

@JonRowe
Copy link

JonRowe commented Apr 27, 2015

I think that recent versions of rspec-rails aren't running rails initializers on startup - I'd need to confirm that with @JonRowe however.

Only if Rails has, rspec-rails merely adapts the Rails test helpers for use with RSpec.

@nomasprime
Copy link

Thanks @jamesotron and @JonRowe for responding so quickly, rules out initializers. This article also helped, I'm new to event callback model but just about wrapped my head around it now.

@leei
Copy link

leei commented Jun 24, 2015

See my answer on StackOverflow for another approach.

@clairezed
Copy link

Hello @jamesotron, thanks for your work on FayeRails ! I'm running a similar problem in a rake task, launched via a cron. (RuntimeError) "eventmachine not initialized: evma_install_oneshot_timer".

The error isn't raised systematically.When it is, it happens when the tasks hits a line where a custom Controller (inheriting FayeRails::Controller) tries to publish a message.

My conf :

  • ruby 2.1.2
  • rails '4.1.6'
    *faye-rails 2.0.0

I have the same initializer as @deemytch, and I'm a bit lost regarding what I could do. The app is on production (the problem never popped while on dev) and I'm not into monkeypatching (as suggests @habitullence article). Would you have any clue on how to get rid of this error ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants