Sha256: 0975abb5e6459aa15f3a312b718b50e689c724b7a126694886d506626b4ee5fe

Contents?: true

Size: 679 Bytes

Versions: 2

Compression:

Stored size: 679 Bytes

Contents

module Kuroko2
  module Workflow
    module Task
      class Queue < Base
        def execute
          if option.present?
            token.context['QUEUE'] = option
          else
            token.context['QUEUE'] = Execution::DEFAULT_QUEUE
          end

          :next
        end

        def validate
          unless /\A\@?[\w_-]{1,180}\z/ === option
            raise Workflow::AssertionError, "Queue name must be match with /\A\@?[\w_-]{1,255}\z/: #{option}"
          end

          unless Worker.where(queue: option, working: true).exists?
            raise Workflow::AssertionError, "No such queue : #{option}"
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kuroko2-0.3.1 lib/autoload/kuroko2/workflow/task/queue.rb
kuroko2-0.3.0 lib/autoload/kuroko2/workflow/task/queue.rb