Skip to content

Commit 94f9a55

Browse files
committed
Address linter and depedency injection issues
1 parent a224081 commit 94f9a55

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

common/resource/fx.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import (
88
"time"
99

1010
"go.temporal.io/api/workflowservice/v1"
11+
"go.temporal.io/server/api/adminservice/v1"
1112
"go.temporal.io/server/api/historyservice/v1"
1213
"go.temporal.io/server/api/matchingservice/v1"
1314
"go.temporal.io/server/client"
15+
"go.temporal.io/server/client/admin"
1416
"go.temporal.io/server/client/frontend"
1517
"go.temporal.io/server/client/history"
1618
"go.temporal.io/server/client/matching"
@@ -59,6 +61,9 @@ type (
5961
MatchingRawClient matchingservice.MatchingServiceClient
6062
MatchingClient matchingservice.MatchingServiceClient
6163

64+
AdminRawClient adminservice.AdminServiceClient
65+
AdminClient adminservice.AdminServiceClient
66+
6267
RuntimeMetricsReporterParams struct {
6368
fx.In
6469

@@ -90,6 +95,8 @@ var Module = fx.Options(
9095
fx.Provide(ClientFactoryProvider),
9196
fx.Provide(ClientBeanProvider),
9297
fx.Provide(FrontendClientProvider),
98+
fx.Provide(AdminRawClientProvider),
99+
fx.Provide(AdminClientProvider),
93100
fx.Provide(GrpcListenerProvider),
94101
fx.Provide(RuntimeMetricsReporterProvider),
95102
metrics.RuntimeMetricsReporterLifetimeHooksModule,
@@ -243,6 +250,18 @@ func FrontendClientProvider(clientBean client.Bean) workflowservice.WorkflowServ
243250
)
244251
}
245252

253+
func AdminRawClientProvider(clientBean client.Bean, clusterMetadata cluster.Metadata) (AdminRawClient, error) {
254+
return clientBean.GetRemoteAdminClient(clusterMetadata.GetCurrentClusterName())
255+
}
256+
257+
func AdminClientProvider(adminRawClient AdminRawClient) AdminClient {
258+
return admin.NewRetryableClient(
259+
adminRawClient,
260+
common.CreateFrontendClientRetryPolicy(),
261+
common.IsServiceClientTransientError,
262+
)
263+
}
264+
246265
func RuntimeMetricsReporterProvider(
247266
params RuntimeMetricsReporterParams,
248267
) *metrics.RuntimeMetricsReporter {

service/worker/batcher/activities_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ func (s *activitiesSuite) TestAdjustQueryAdminBatchType() {
364364
},
365365
}
366366
adjustedQuery := a.adjustQueryAdminBatchType(adminReq)
367-
s.Equal("", adjustedQuery)
367+
s.Empty(adjustedQuery)
368368
})
369369

370370
s.Run("RefreshWorkflowTasks adds running filter", func() {

service/worker/batcher/fx.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import (
44
"go.temporal.io/api/workflowservice/v1"
55
sdkworker "go.temporal.io/sdk/worker"
66
"go.temporal.io/sdk/workflow"
7-
"go.temporal.io/server/api/adminservice/v1"
87
"go.temporal.io/server/common/dynamicconfig"
98
"go.temporal.io/server/common/log"
109
"go.temporal.io/server/common/metrics"
1110
"go.temporal.io/server/common/namespace"
11+
"go.temporal.io/server/common/resource"
1212
"go.temporal.io/server/common/sdk"
1313
workercommon "go.temporal.io/server/service/worker/common"
1414
"go.uber.org/fx"
@@ -34,7 +34,7 @@ type (
3434
Logger log.Logger
3535
ClientFactory sdk.ClientFactory
3636
FrontendClient workflowservice.WorkflowServiceClient
37-
AdminClient adminservice.AdminServiceClient
37+
AdminClient resource.AdminClient
3838
}
3939

4040
fxResult struct {

tools/tdbg/commands.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,8 @@ func AdminBatchRefreshWorkflowTasks(c *cli.Context, clientFactory ClientFactory)
718718
return fmt.Errorf("unable to start batch refresh workflow tasks: %w", err)
719719
}
720720

721-
fmt.Fprintf(c.App.Writer, "Batch job %s started successfully.\n", color.MagentaString(jobID))
721+
// nolint:errcheck // assuming that write will succeed.
722+
fmt.Fprintln(c.App.Writer, "Batch Refresh Workflow Tasks started successfully.")
722723
return nil
723724
}
724725

0 commit comments

Comments
 (0)