Class: RactorPool::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/ractor_pool/worker.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Worker

Returns a new instance of Worker.



4
5
6
7
8
9
10
11
12
# File 'lib/ractor_pool/worker.rb', line 4

def initialize(*args)
  Ractor.new(args) do |worker_id, jobs_pipe, _results_pipe, logger|
    # logger = Logger.new($stdout)
    jobs_pipe.subscribe do |data|
      logger.debug("Worker #{worker_id}: received data: #{data}")
      yield(data, logger)
    end
  end
end