Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Deprecate Worker() and Client() in favor of NewWorker() DefaultClient() #95

Merged

Conversation

grantfuhr
Copy link
Contributor

Signed-off-by: grantfuhr grant.fuhr@datadoghq.com

What changed?
This PR deprecates Worker() and Client() functions in the TemporalTest package.

Why?
The naming convention NewWorker() and NewClient() is more consistent with the rest of the project.

How did you test it?
Yes. Tested locally

Potential risks
Some Temporaltest tests may fail.

Is hotfix candidate?
No

Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
temporaltest/server.go Outdated Show resolved Hide resolved
temporaltest/server.go Outdated Show resolved Hide resolved
temporaltest/server.go Show resolved Hide resolved
Comment on lines 104 to 107
if ts.defaultClient == nil {
ts.defaultClient = ts.NewClientWithOptions(ts.defaultClientOptions)
}
return ts.defaultClient
Copy link
Collaborator

Choose a reason for hiding this comment

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

The reason this function wasn't initially named NewClient was because it actually memoizes the client being returned. But I think it's ok to "lie" here and simply reuse the same client for each call... anyone who really wants a newly instantiated client will still be able to use NewClientWithOptions. This leaves the door open for us to create a separate client for each invocation if we need to for whatever reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think about naming this DefaultClient? This seems more in line with what the function is actually doing. If users want a custom, newly instantiated client they can use NewClientWithOptions like you propose.

@CLAassistant
Copy link

CLAassistant commented Aug 1, 2022

CLA assistant check
All committers have signed the CLA.

Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
@grantfuhr grantfuhr changed the title Deprecate Worker() and Client() in favor of NewWorker() NewClient() Deprecate Worker() and Client() in favor of NewWorker() DefaultClient() Aug 2, 2022
Copy link
Collaborator

@jlegrone jlegrone left a comment

Choose a reason for hiding this comment

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

lgtm! I'll leave this open for a bit longer in case anyone else wants to review.

temporaltest/server.go Outdated Show resolved Hide resolved
Co-authored-by: Jacob LeGrone <jlegrone@users.noreply.github.com>
@jlegrone jlegrone enabled auto-merge (squash) August 4, 2022 16:52
@jlegrone jlegrone merged commit 95f1070 into temporalio:main Aug 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants