Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix merge map of payload #3412

Merged
merged 1 commit into from Sep 20, 2022

Conversation

rodrigozhou
Copy link
Contributor

What changed?
Fixing the function to merge map of payload. Keys with nil value or empty slice value are removed.

Why?
A bug was leaving keys with nil or empty slice value in the merged map when the first map is nil.

How did you test it?
Added new unit tests to cover those cases.

Potential risks
No.

Is hotfix candidate?
Yes.

@rodrigozhou rodrigozhou requested a review from a team as a code owner September 20, 2022 00:41
if m1 == nil {
return maps.Clone(m2)
if m2 == nil {
return maps.Clone(m1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just return m1 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think I could. But thought about what if it's changed outside after this function is called. It would change the map reference, and have unexpected side effects maybe. I don't know, just thought it would be safer like this.

@rodrigozhou rodrigozhou merged commit 91c31f1 into temporalio:master Sep 20, 2022
@rodrigozhou rodrigozhou deleted the fix-merge-map-payload branch September 20, 2022 01:26
dnr pushed a commit that referenced this pull request Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants