Skip to content

Commit

Permalink
Merge pull request coinbase#72 from stripe-private-oss-forks/calum-fi…
Browse files Browse the repository at this point in the history
…xing-list-workflows-bug

Added fix for nil search attributes when listing workflows
  • Loading branch information
calum-stripe authored and GitHub Enterprise committed Mar 8, 2022
2 parents c698f70 + e45bbef commit 7170411
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/temporal/workflow/execution_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ExecutionInfo < Struct.new(:workflow, :workflow_id, :run_id, :start_time,
]

def self.generate_from(response)
search_attributes = self.from_payload_map(response.search_attributes.indexed_fields) if !response.search_attributes.nil?
new(
workflow: response.type.name,
workflow_id: response.execution.workflow_id,
Expand All @@ -26,7 +27,7 @@ def self.generate_from(response)
status: Temporal::Workflow::Status::API_STATUS_MAP.fetch(response.status),
history_length: response.history_length,
memo: self.from_payload_map(response.memo.fields),
search_attributes: self.from_payload_map(response.search_attributes.indexed_fields),
search_attributes: search_attributes,
).freeze
end

Expand Down
7 changes: 7 additions & 0 deletions spec/unit/lib/temporal/workflow/execution_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
it 'freezes the info' do
expect(subject).to be_frozen
end

it 'deserializes if search_attributes is nil' do
api_info.search_attributes = nil

result = described_class.generate_from(api_info)
expect(result.search_attributes).to be_nil
end
end

describe 'statuses' do
Expand Down

0 comments on commit 7170411

Please sign in to comment.