Sha256: 462205125d7caf1b4649a265b7742a8594732e10ff118525c5f01de8d386150e

Contents?: true

Size: 591 Bytes

Versions: 1

Compression:

Stored size: 591 Bytes

Contents

module Maxwell
  module Agent
    class Scheduler
      include Celluloid

      def initialize
        async.run
      end

      def work_schedule
        runner[:work_schedule]
      end

      def run
        loop do
          sleep Agent.configuration.work_poll
          schedule_work
        end
      end

      def schedule_work
        work = work_schedule.get
        worker.async.perform(work) if work
      end

      def worker
        runner[:worker]
      end

      def runner
        links.detect {|link| Celluloid::SupervisionGroup === link }
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maxwell_agent-0.0.5 lib/maxwell/agent/scheduler.rb