Skip to content

Commit

Permalink
Move SHUTDOWN_TIMEOUT to a method
Browse files Browse the repository at this point in the history
Remove a constant per the request in celluloid#159.  Replace with a class method
which returns the same default value.
  • Loading branch information
Josh Adams committed Mar 8, 2013
1 parent adbbbd8 commit b551c3e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/celluloid.rb
Expand Up @@ -6,9 +6,6 @@
module Celluloid
extend self # expose all instance methods as singleton methods

# How long actors have to terminate
SHUTDOWN_TIMEOUT = 10

# Warning message added to Celluloid objects accessed outside their actors
BARE_OBJECT_WARNING_MESSAGE = "WARNING: BARE CELLULOID OBJECT "

Expand Down Expand Up @@ -52,7 +49,7 @@ def exception_handler(&block)

# Shut down all running actors
def shutdown
Timeout.timeout(SHUTDOWN_TIMEOUT) do
Timeout.timeout(shutdown_timeout) do
actors = Actor.all
Logger.debug "Terminating #{actors.size} actors..." if actors.size > 0

Expand All @@ -77,7 +74,12 @@ def shutdown
Logger.debug "Shutdown completed cleanly"
end
rescue Timeout::Error => ex
Logger.error("Couldn't cleanly terminate all actors in #{SHUTDOWN_TIMEOUT} seconds!")
Logger.error("Couldn't cleanly terminate all actors in #{shutdown_timeout} seconds!")
end

# How long actors have to terminate
def shutdown_timeout
10
end
end

Expand Down

0 comments on commit b551c3e

Please sign in to comment.