Skip to content

Commit

Permalink
Make sure the driver is shutdown on Task#unregister!.
Browse files Browse the repository at this point in the history
This appears to greatly reduce memory leaks on "god load".
  • Loading branch information
eric committed Nov 5, 2009
1 parent c173ced commit 3e4fd28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/god/driver.rb
Expand Up @@ -182,6 +182,13 @@ def initialize(task)
def clear_events
@events.clear
end

# Shutdown the DriverEventQueue threads
#
# Returns nothing
def shutdown
@events.shutdown
end

# Queue an asynchronous message
# +name+ is the Symbol name of the operation
Expand Down
2 changes: 1 addition & 1 deletion lib/god/task.rb
Expand Up @@ -299,7 +299,7 @@ def register!
end

def unregister!
# override if necessary
driver.shutdown
end

###########################################################################
Expand Down
1 change: 1 addition & 0 deletions lib/god/watch.rb
Expand Up @@ -177,6 +177,7 @@ def register!

def unregister!
God.registry.remove(@process)
super
end
end

Expand Down

0 comments on commit 3e4fd28

Please sign in to comment.