Skip to content

Commit 1e2c655

Browse files
committed
Dump and load during serialization
This has two effects - it casts the input to only contain JSON-native objects and removes amiguity on the receiving end. With the previous implementation, we couldn't reliably distinguish whether what we're accessing was previously dumped into a json by dynflow or if it is a user-provided json-encoded string.
1 parent 0d06431 commit 1e2c655

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/dynflow/executors/sidekiq/serialization.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ module Sidekiq
66
# Module to prepend the Sidekiq job to handle the serialization
77
module Serialization
88
def self.serialize(value)
9-
JSON.dump(Dynflow.serializer.dump(value))
9+
JSON.parse(JSON.dump(Dynflow.serializer.dump(value)))
1010
end
1111

1212
def self.deserialize(value)
13-
object = JSON.load(value)
14-
object = Utils::IndifferentHash.new(object) if object.is_a? Hash
15-
Dynflow.serializer.load(object)
13+
value = Utils::IndifferentHash.new(value) if value.is_a? Hash
14+
Dynflow.serializer.load(value)
1615
end
1716

1817
module WorkerExtension

0 commit comments

Comments
 (0)