Sha256: 36070b3efa475fbcc4f2554036fdb7f3529083158f4fe31d1de10218d707c523

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

module Maxwell
  module Agent
    class Worker
      include Celluloid

      def perform(work)
        work.perform

        post_run(work)
      ensure
        work_schedule.put_back(work)
      end

      def work_schedule
        Agent.runner[:work_schedule]
      end

    private

      def post_run(work)
        work.perform_at = nil
        work.last_run = Time.now

        Agent.middleware.invoke(work)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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