Last active
December 24, 2015 10:18
-
-
Save cpuguy83/6782863 to your computer and use it in GitHub Desktop.
Running clockwork in a separate process is for suckers...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyApp | |
class Clock | |
include Celluloid | |
include Clockwork | |
require_relative '../clockwork' | |
end | |
end | |
supervisor = MyApp::Clock.supervise_as :myapp_clock | |
clock = supervisor.actors.first | |
clock.async.run |
@cpuguy83 you should probably use Celluloid::Actor[:myapp_clock]
to access the supervised actor.
Or use supervisor[:myapp_clock]
if using master. 😀
Hey there,
How do you invoke this file? Do you keep in config/ folder so that when the server starts up it is executed? I tried using it in config/initializers but it gets called when I run rake or rails console so used a data store to check if it is running.
Thanks,
Deepak
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't do this on MRI