Skip to content

Commit

Permalink
[code-coverage] update admin and frontend client to use generated code (
Browse files Browse the repository at this point in the history
cadence-workflow#5702)

* [code-coverage] update admin client to use generated code

* delete client.go to be replaced

* [code-coverage] update frontend client to use generated code

* rename package to timeout

* fix lint and updated comments in template

* fix merge conflict with histoy client changes and seperate createContext logic

* delete timed.tmpl

* add check for nonnegative timeout in createContext

* rename constants.go file to timeout

* resolve last merge conflicts
  • Loading branch information
ketsiambaku authored Mar 8, 2024
1 parent ee74964 commit da4cbf2
Show file tree
Hide file tree
Showing 11 changed files with 775 additions and 1,281 deletions.
422 changes: 0 additions & 422 deletions client/admin/client.go

This file was deleted.

1 change: 1 addition & 0 deletions client/admin/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
//go:generate gowrap gen -g -p . -i Client -t ../templates/errorinjectors.tmpl -o ../wrappers/errorinjectors/admin_generated.go -v client=Admin
//go:generate gowrap gen -g -p . -i Client -t ../templates/grpc.tmpl -o ../wrappers/grpc/admin_generated.go -v client=Admin -v package=adminv1 -v path=github.com/uber/cadence-idl/go/proto/admin/v1 -v prefix=Admin
//go:generate gowrap gen -g -p . -i Client -t ../templates/thrift.tmpl -o ../wrappers/thrift/admin_generated.go -v client=Admin -v prefix=Admin
//go:generate gowrap gen -g -p . -i Client -t ../templates/timeout.tmpl -o ../wrappers/timeout/admin_generated.go -v client=Admin

// Client is the interface exposed by admin service client
type Client interface {
Expand Down
9 changes: 5 additions & 4 deletions client/clientBean.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/uber/cadence/client/frontend"
"github.com/uber/cadence/client/history"
"github.com/uber/cadence/client/matching"
"github.com/uber/cadence/client/wrappers/timeout"
"github.com/uber/cadence/common/cluster"
)

Expand Down Expand Up @@ -73,17 +74,17 @@ func NewClientBean(factory Factory, dispatcher *yarpc.Dispatcher, clusterMetadat

adminClient, err := factory.NewAdminClientWithTimeoutAndConfig(
clientConfig,
admin.DefaultTimeout,
admin.DefaultLargeTimeout,
timeout.AdminDefaultTimeout,
timeout.AdminDefaultLargeTimeout,
)
if err != nil {
return nil, err
}

frontendClient, err := factory.NewFrontendClientWithTimeoutAndConfig(
clientConfig,
frontend.DefaultTimeout,
frontend.DefaultLongPollTimeout,
timeout.FrontendDefaultTimeout,
timeout.FrontendDefaultLongPollTimeout,
)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions client/clientfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (cf *rpcClientFactory) NewAdminClientWithTimeoutAndConfig(
client = thrift.NewAdminClient(adminserviceclient.New(config))
}

client = admin.NewClient(timeout, largeTimeout, client)
client = timeoutwrapper.NewAdminClient(client, largeTimeout, timeout)
if errorRate := cf.dynConfig.GetFloat64Property(dynamicconfig.AdminErrorInjectionRate)(); errorRate != 0 {
client = errorinjectors.NewAdminClient(client, errorRate, cf.logger)
}
Expand All @@ -208,7 +208,7 @@ func (cf *rpcClientFactory) NewFrontendClientWithTimeoutAndConfig(
client = thrift.NewFrontendClient(workflowserviceclient.New(config))
}

client = frontend.NewClient(timeout, longPollTimeout, client)
client = timeoutwrapper.NewFrontendClient(client, longPollTimeout, timeout)
if errorRate := cf.dynConfig.GetFloat64Property(dynamicconfig.FrontendErrorInjectionRate)(); errorRate != 0 {
client = errorinjectors.NewFrontendClient(client, errorRate, cf.logger)
}
Expand Down
Loading

0 comments on commit da4cbf2

Please sign in to comment.