Sha256: 46a7a8af59c797a1a5b54113fd39430c654f34eeebce40c7f667b2298a7caf42
Contents?: true
Size: 571 Bytes
Versions: 1
Compression:
Stored size: 571 Bytes
Contents
require "tennis/actor" module Tennis class Fetcher include Actor attr_reader :worker_pool def initialize(worker_pool, options) @job_classes = options[:job_classes] @worker_pool = worker_pool @backend = Tennis.config.backend @done = false end def fetch return if done? if task = @backend.receive(job_classes: @job_classes) worker_pool.async.work(task) else async.fetch end end def done! @done = true end private def done? @done end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tennis-jobs-0.4.0 | lib/tennis/fetcher.rb |