Created
May 22, 2013 18:18
-
-
Save jwo/5629696 to your computer and use it in GitHub Desktop.
Rails app with celluloid -- http://stackoverflow.com/questions/16694102/
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
Started GET "/pages/create" for 127.0.0.1 at 2013-05-22 13:15:01 -0500 | |
Processing by PagesController#create as HTML | |
About to sleep 2013-05-22 13:15:01 -0500 | |
Rendered pages/create.html.erb within layouts/application (0.5ms) | |
Completed 200 OK in 8ms (Views: 5.3ms | ActiveRecord: 0.0ms) | |
Awake! 2013-05-22 13:15:11 -0500 |
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
class PagesController < ApplicationController | |
def root | |
end | |
def create | |
SleepyWorker.new.async.sleep_for(10) | |
end | |
end |
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
class SleepyWorker | |
include Celluloid | |
def sleep_for(seconds=5) | |
puts "About to sleep #{Time.now}" | |
sleep seconds | |
puts "Awake! #{Time.now}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment