diff --git a/lib/dynflow/executors/sidekiq/core.rb b/lib/dynflow/executors/sidekiq/core.rb index 0abbee0c..491c6f09 100644 --- a/lib/dynflow/executors/sidekiq/core.rb +++ b/lib/dynflow/executors/sidekiq/core.rb @@ -13,7 +13,7 @@ config[:semi_reliable_fetch] = true Sidekiq::ReliableFetch.setup_reliable_fetch!(config) end -::Sidekiq.strict_args!(false) +::Sidekiq.strict_args! module Dynflow module Executors diff --git a/lib/dynflow/executors/sidekiq/serialization.rb b/lib/dynflow/executors/sidekiq/serialization.rb index 9603dbb0..5c05c300 100644 --- a/lib/dynflow/executors/sidekiq/serialization.rb +++ b/lib/dynflow/executors/sidekiq/serialization.rb @@ -6,7 +6,7 @@ module Sidekiq # Module to prepend the Sidekiq job to handle the serialization module Serialization def self.serialize(value) - Dynflow.serializer.dump(value) + JSON.parse(JSON.dump(Dynflow.serializer.dump(value))) end def self.deserialize(value) @@ -18,6 +18,7 @@ module WorkerExtension # Overriding the Sidekiq entry method to perform additional serialization preparation module ClassMethods def client_push(opts) + opts = Utils::IndifferentHash.new(opts) opts['args'] = opts['args'].map { |a| Serialization.serialize(a) } super(opts) end diff --git a/lib/dynflow/serializer.rb b/lib/dynflow/serializer.rb index b243a242..95e6671c 100644 --- a/lib/dynflow/serializer.rb +++ b/lib/dynflow/serializer.rb @@ -24,6 +24,8 @@ def dump(object, options = {}) case object when ::Array object.collect { |v| dump(v) } + when ::Symbol + generate_other(object) else super end @@ -38,7 +40,9 @@ def parse_other(other, options = {}) end if (type_name = other[ARBITRARY_TYPE_KEY] || other[ARBITRARY_TYPE_KEY.to_s]) - if type_name == 'Time' && (time_str = other['value']) + if type_name == 'Symbol' && (val_str = other['value']) + return val_str.to_sym + elsif type_name == 'Time' && (time_str = other['value']) return Serializable.send(:string_to_time, time_str) end type = Utils.constantize(type_name) rescue nil @@ -53,6 +57,8 @@ def parse_other(other, options = {}) def generate_other(object, options = {}) hash = case + when object.is_a?(Symbol) + { ARBITRARY_TYPE_KEY => 'Symbol', 'value' => object.to_s } when object.respond_to?(:to_h) object.to_h when object.respond_to?(:to_hash)