ruby - Celluloid SupervisionGroup does not work -


i write following script in order understand celluloid.

require 'celluloid/current'  class processor   include celluloid    def perfom(number)     puts "#{number} ... (#{thread.current}) ..."     sleep(number%3)     puts "launch finish!"     return number   end end  pool = processor.pool(size: 3)  futures = (1..7).map |i|   pool.future(:perfom, i) end puts futures.map(&:value)  pool.terminate 

all work fine , want avoid call terminate on pool.

so try use supervisor raise me uninitialized constant celluloid::supervisiongroup

after search find (in deprecated folder) : (https://github.com/celluloid/celluloid-supervision/blob/master/spec/celluloid/deprecate/supervision/supervision_group_spec.rb)

i wanted make work :

supervisor = celluloid::supervisiongroup.run! pool       = supervisor.pool(processor, size: 3, as: :worker)  futures = (1..7).map |i|   pool[:worker].future(:perfom, i) end puts futures.map(&:value) 

how can make work future, supervisor , pool new system?

celluloid::supervisiongroup renamed celluloid::supervision::container

see https://github.com/celluloid/celluloid/wiki/deprecation-warning


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -