brandonhilkert / sucker_punch

Sucker Punch is a Ruby asynchronous processing library using concurrent-ruby, heavily influenced by Sidekiq and girl_friday.
MIT License
2.65k stars 114 forks source link

Cannot use celluloid actor registry #99

Closed trungpham closed 9 years ago

trungpham commented 9 years ago

https://github.com/brandonhilkert/sucker_punch/blob/master/lib/sucker_punch/railtie.rb#L8 SuckerPunch is blindly clearing out the actor registry.

brandonhilkert commented 9 years ago

Are you requiring sucker_punch in startup? Rails?

On Monday, February 16, 2015, Trung Pham notifications@github.com wrote:

https://github.com/brandonhilkert/sucker_punch/blob/master/lib/sucker_punch/railtie.rb#L8 SuckerPunch is blindly clearing out the actor registry.

— Reply to this email directly or view it on GitHub https://github.com/brandonhilkert/sucker_punch/issues/99.


_Build a Ruby Gem is available! http://brandonhilkert.com/books/build-a-ruby-gem/?utm_source=gmail-sig&utm_medium=email&utm_campaign=gmail_

http://brandonhilkert.com

trungpham commented 9 years ago

Gemfile

brandonhilkert commented 9 years ago

Happy to try and help more if you can post code you're using.

nullstyle commented 9 years ago

:+1:

This makes registering actors in config/initializers a bit of a pain because the to_prepare block that clears the registry will run after the initializer files.

You have to wrap your actor initialization in a Railtie (or add it to your after_initialize config) like so:

class FriendbotRailtie < ::Rails::Railtie
  config.to_prepare do
    Friendbot.supervise_as :friendbot
  end
end
nullstyle commented 9 years ago

It seems like a better solution would be to prefix all the suckerpunch actor names such that you only clear the suckerpunch owned actors. Would you be open to a PR that does this?

brandonhilkert commented 9 years ago

Sure!

On Tuesday, April 7, 2015, Scott Fleckenstein notifications@github.com wrote:

It seems like a better solution would be to prefix all the suckerpunch actor names such that you only clear the suckerpunch owned actors. Would you be open to a PR that does this?

— Reply to this email directly or view it on GitHub https://github.com/brandonhilkert/sucker_punch/issues/99#issuecomment-90749535 .


_Build a Ruby Gem is available! http://brandonhilkert.com/books/build-a-ruby-gem/?utm_source=gmail-sig&utm_medium=email&utm_campaign=gmail_

http://brandonhilkert.com