Skip to content

Commit 85aafcb

Browse files
committed
Revert changes to the signature of MarkReadyAndWait()
We can trivially pass the grpcClientFactory into LifecycleState when constructing it, so there is no need to give it back to the caller, requiring it to pass it in manually.
1 parent 214cfae commit 85aafcb

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

cmd/bb_replicator/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func main() {
7070
return util.StatusWrap(err, "gRPC server failure")
7171
}
7272

73-
lifecycleState.MarkReadyAndWait(siblingsGroup, grpcClientFactory)
73+
lifecycleState.MarkReadyAndWait(siblingsGroup)
7474
return nil
7575
})
7676
}

cmd/bb_storage/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ func main() {
221221
return util.StatusWrap(err, "gRPC server failure")
222222
}
223223

224-
lifecycleState.MarkReadyAndWait(siblingsGroup, grpcClientFactory)
224+
lifecycleState.MarkReadyAndWait(siblingsGroup)
225225
return nil
226226
})
227227
}

pkg/global/apply_configuration.go

+13-7
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ import (
5353
type LifecycleState struct {
5454
config *pb.DiagnosticsHTTPServerConfiguration
5555
activeSpansReportingHTTPHandler *bb_otel.ActiveSpansReportingHTTPHandler
56+
grpcClientFactory bb_grpc.ClientFactory
5657
}
5758

5859
// MarkReadyAndWait can be called to report that the program has started
5960
// successfully. The application should now be reported as being healthy
6061
// and ready, and receive incoming requests if applicable.
61-
func (ls *LifecycleState) MarkReadyAndWait(group program.Group, grpcClientFactory bb_grpc.ClientFactory) {
62+
func (ls *LifecycleState) MarkReadyAndWait(group program.Group) {
6263
// Start a diagnostics web server that exposes Prometheus
6364
// metrics and provides a health check endpoint.
6465
if ls.config != nil {
@@ -78,7 +79,8 @@ func (ls *LifecycleState) MarkReadyAndWait(group program.Group, grpcClientFactor
7879
ls.config.HttpServers,
7980
bb_http.NewMetricsHandler(router, "Diagnostics"),
8081
group,
81-
grpcClientFactory)
82+
ls.grpcClientFactory,
83+
)
8284
}
8385
}
8486

@@ -356,15 +358,19 @@ func ApplyConfiguration(configuration *pb.Configuration) (*LifecycleState, bb_gr
356358
}()
357359
}
358360

361+
grpcClientFactory := bb_grpc.NewDeduplicatingClientFactory(
362+
bb_grpc.NewBaseClientFactory(
363+
grpcClientDialer,
364+
grpcUnaryInterceptors,
365+
grpcStreamInterceptors,
366+
),
367+
)
359368
return &LifecycleState{
360369
config: configuration.GetDiagnosticsHttpServer(),
361370
activeSpansReportingHTTPHandler: activeSpansReportingHTTPHandler,
371+
grpcClientFactory: grpcClientFactory,
362372
},
363-
bb_grpc.NewDeduplicatingClientFactory(
364-
bb_grpc.NewBaseClientFactory(
365-
grpcClientDialer,
366-
grpcUnaryInterceptors,
367-
grpcStreamInterceptors)),
373+
grpcClientFactory,
368374
nil
369375
}
370376

0 commit comments

Comments
 (0)