在SupervisionGroup中更改池大小

时间:2014-10-15 10:13:07

标签: ruby celluloid

我可以改变赛璐珞监管组的水池大小吗?

例如,我有一名工人:

class Worker 
  include Celluloid

  def do
    puts self.inspect
  end
end

然后我在一个监督小组中安排了3名工人:

supervisor = Celluloid::SupervisionGroup.run!
supervisor.pool(Worker, size: 3, as: :worker)

我可以以某种方式修改supervisor中的池大小吗?

感谢。

1 个答案:

答案 0 :(得分:0)

确定。发现它:

supervisor = Celluloid::SupervisionGroup.run!
pool = supervisor.pool(Worker, size: 3, as: :worker)  # Number of workers = 3

...

pool.size = 2        # Change number of pooled workers from 3 to 2