Sha256: d0c5d145da5cb0964886c5f8e740220cf5609b1b1fc306ad05dbc9ab805bdad5

Contents?: true

Size: 984 Bytes

Versions: 22

Compression:

Stored size: 984 Bytes

Contents

module Kuroko2
  module Workflow
    module Processor
      def initialize
        @hostname = Socket.gethostname

        @stop       = ServerEngine::BlockingFlag.new
        @processing = ServerEngine::BlockingFlag.new

        @workflow = Workflow::Engine.new
      end

      def run
        Kuroko2.logger = logger
        Kuroko2.logger.info "[#{@hostname}-#{worker_id}] Start Workflow::Processor"

        until @stop.wait(1.0)
          unless @processing.set?
            begin
              @processing.set!
              @workflow.process_all
              @processing.reset!
            end
          end
        end
      rescue Exception => e
        Kuroko2.logger.fatal("[#{@hostname}-#{worker_id}] #{e.class}: #{e.message}\n" +
          e.backtrace.map { |trace| "    #{trace}" }.join("\n"))

        raise e
      end

      def stop
        Kuroko2.logger.info "[#{@hostname}-#{worker_id}] Stop Workflow::Processor"

        @stop.set!
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kuroko2-0.8.0 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.7.0 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.6.0 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.5.2 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.5.1 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.5.0 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.4.6 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.4.5 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.4.4 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.4.3 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.4.2 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.4.1 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.4.0 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.3.4 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.3.3 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.3.2 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.3.1 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.3.0 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.2.3 lib/autoload/kuroko2/workflow/processor.rb
kuroko2-0.2.2 lib/autoload/kuroko2/workflow/processor.rb