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

Commit

Permalink
verifyOptions should return the newly created option
Browse files Browse the repository at this point in the history
  • Loading branch information
datoug committed Feb 10, 2017
1 parent ee74cba commit 38917fb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions client/cherami/client.go
Expand Up @@ -88,7 +88,7 @@ func NewHyperbahnClient(serviceName string, bootstrapFile string, options *Clien
// NewClientWithFE is used by Frontend to create a Cherami client for itself.
// It is used by non-streaming publish/consume APIs.
func NewClientWithFE(feClient cherami.TChanBFrontend, options *ClientOptions) Client {
verifyOptions(options)
options = verifyOptions(options)

return &clientImpl{
client: feClient,
Expand All @@ -98,7 +98,7 @@ func NewClientWithFE(feClient cherami.TChanBFrontend, options *ClientOptions) Cl
}

func newClientWithTChannel(ch *tchannel.Channel, options *ClientOptions) (Client, error) {
verifyOptions(options)
options = verifyOptions(options)

tClient := thrift.NewClient(ch, getFrontEndServiceName(options.DeploymentStr), nil)

Expand Down Expand Up @@ -255,7 +255,7 @@ func (c *clientImpl) CreatePublisher(request *CreatePublisherRequest) Publisher

func (c *clientImpl) CreateConsumer(request *CreateConsumerRequest) Consumer {
if request.Options != nil {
verifyOptions(request.options)
request.Options = verifyOptions(request.Options)
} else {
request.Options = c.options
}
Expand Down Expand Up @@ -344,7 +344,7 @@ func getDefaultOptions() *ClientOptions {
// verifyOptions is used to verify if we have a metrics reporter and
// a logger. If not, just setup a default logger and a null reporter
// it also validate the timeout is sane
func verifyOptions(opts *ClientOptions) {
func verifyOptions(opts *ClientOptions) *ClientOptions{
if opts == nil {
opts = getDefaultOptions()
}
Expand All @@ -364,6 +364,7 @@ func verifyOptions(opts *ClientOptions) {

// Now make sure we init the default metrics as well
opts.MetricsReporter.InitMetrics(metrics.MetricDefs)
return opts
}

func createDefaultRetryPolicy() backoff.RetryPolicy {
Expand Down

0 comments on commit 38917fb

Please sign in to comment.