Sha256: 2438081a8592340b5ce308dbba11b3c9307666a9d23baec98de60719356efcb8
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
require 'legion/extensions/conditioner/helpers/condition' module Legion::Extensions::Conditioner module Runners module Conditioner def self.check(**payload) # rubocop:disable Metrics/AbcSize conditioner = Legion::Extensions::Conditioner::Condition.new(conditions: payload[:conditions], task_id: payload[:task_id], values: payload, type: payload[:type]) if conditioner.valid? Legion::Extensions::Conditioner::Transport::Messages::Conditioner.new(**payload).publish status = 'task.queued' else status = 'conditioner.failed' end task_update(payload[:task_id], status, **payload) unless payload[:task_id].nil? if payload[:debug] && payload.key?(:task_id) generate_task_log(task_id: payload[:task_id], function: 'check', valid: conditioner.valid?, conditions: payload[:conditions], values: payload) end { success: true, valid: conditioner.valid? } rescue StandardError => e Legion::Logging.error 'LEX::Conditioner::Runners::Condition had an exception' Legion::Logging.warn e.message Legion::Logging.warn e.backtrace unless payload[:task_id].nil? Legion::Transport::Messages::TaskUpdate.new(task_id: payload[:task_id], status: 'conditioner.failed').publish end end include Legion::Extensions::Helpers::Lex include Legion::Extensions::Helpers::Task end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lex-conditioner-0.2.1 | lib/legion/extensions/conditioner/runners/conditioner.rb |