Skip to content

Instantly share code, notes, and snippets.

@cpuguy83
Last active December 24, 2015 10:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpuguy83/6782863 to your computer and use it in GitHub Desktop.
Save cpuguy83/6782863 to your computer and use it in GitHub Desktop.
Running clockwork in a separate process is for suckers...
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
Copy link
Author

cpuguy83 commented Oct 1, 2013

Don't do this on MRI

@halorgium
Copy link

@cpuguy83 you should probably use Celluloid::Actor[:myapp_clock] to access the supervised actor.
Or use supervisor[:myapp_clock] if using master. 😀

@deepakmani
Copy link

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