Skip to content

Grow, shrink a pool #120

Closed
wants to merge 1 commit into from

4 participants

@ileitch
ileitch commented Nov 17, 2012

This adds the ability to grow, shrink a pool and inspect its mailbox message queue size.

  • The minimum pool size is now 1. I have a use case where a pool can be grown, shrunk dynamically via HUP signals. Users may choose to shrink to 1, or even 0 during low traffic periods.

  • mailbox_size is defined on the ActorProxy, which of course exposes this to all actors. Perhaps this method is also useful for single actors.

@ileitch
ileitch commented Nov 18, 2012

Hold off on this, I'm investigating a deadlock.

@ileitch
ileitch commented Nov 18, 2012

OK not an issue with these changes, reproduced the deadlock with stock 0.12.3; #121.

@tarcieri tarcieri commented on the diff Dec 12, 2012
lib/celluloid/pool_manager.rb
@@ -115,5 +125,15 @@ def method_missing(method, *args, &block)
super
end
end
+
+ protected
@tarcieri
Celluloid member
tarcieri added a note Dec 12, 2012

I'm not a big fan of protected. Why not private?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@tarcieri tarcieri commented on the diff Jan 30, 2013
lib/celluloid/pool_manager.rb
@@ -10,7 +10,7 @@ class PoolManager
def initialize(worker_class, options = {})
@size = options[:size] || [Celluloid.cores, 2].max
- raise ArgumentError, "minimum pool size is 2" if @size < 2
@tarcieri
Celluloid member
tarcieri added a note Jan 30, 2013

Deadlock probably has something to do with this change

@stakach
stakach added a note Mar 21, 2013

[options[:size] || Celluloid.cores, 2].max would fix that

@tarcieri
Celluloid member
tarcieri added a note Mar 21, 2013

I'd rather have the explicit raise rather than silently switching to a different number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@halorgium
Celluloid member

With the current issues surrounding Pool in #193, I am going to consider this a good idea for later.

@halorgium halorgium closed this Apr 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.