Skip to content

Commit 7170411

Browse files
calum-stripeGitHub Enterprise
authored and
GitHub Enterprise
committed
Merge pull request coinbase#72 from stripe-private-oss-forks/calum-fixing-list-workflows-bug
Added fix for nil search attributes when listing workflows
2 parents c698f70 + e45bbef commit 7170411

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/temporal/workflow/execution_info.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class ExecutionInfo < Struct.new(:workflow, :workflow_id, :run_id, :start_time,
1717
]
1818

1919
def self.generate_from(response)
20+
search_attributes = self.from_payload_map(response.search_attributes.indexed_fields) if !response.search_attributes.nil?
2021
new(
2122
workflow: response.type.name,
2223
workflow_id: response.execution.workflow_id,
@@ -26,7 +27,7 @@ def self.generate_from(response)
2627
status: Temporal::Workflow::Status::API_STATUS_MAP.fetch(response.status),
2728
history_length: response.history_length,
2829
memo: self.from_payload_map(response.memo.fields),
29-
search_attributes: self.from_payload_map(response.search_attributes.indexed_fields),
30+
search_attributes: search_attributes,
3031
).freeze
3132
end
3233

spec/unit/lib/temporal/workflow/execution_info_spec.rb

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
it 'freezes the info' do
2121
expect(subject).to be_frozen
2222
end
23+
24+
it 'deserializes if search_attributes is nil' do
25+
api_info.search_attributes = nil
26+
27+
result = described_class.generate_from(api_info)
28+
expect(result.search_attributes).to be_nil
29+
end
2330
end
2431

2532
describe 'statuses' do

0 commit comments

Comments
 (0)