Skip to content

Commit

Permalink
Revert changes to the signature of MarkReadyAndWait()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
EdSchouten committed Feb 26, 2025
1 parent 214cfae commit 85aafcb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/bb_replicator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func main() {
return util.StatusWrap(err, "gRPC server failure")
}

lifecycleState.MarkReadyAndWait(siblingsGroup, grpcClientFactory)
lifecycleState.MarkReadyAndWait(siblingsGroup)
return nil
})
}
2 changes: 1 addition & 1 deletion cmd/bb_storage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func main() {
return util.StatusWrap(err, "gRPC server failure")
}

lifecycleState.MarkReadyAndWait(siblingsGroup, grpcClientFactory)
lifecycleState.MarkReadyAndWait(siblingsGroup)
return nil
})
}
Expand Down
20 changes: 13 additions & 7 deletions pkg/global/apply_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ import (
type LifecycleState struct {
config *pb.DiagnosticsHTTPServerConfiguration
activeSpansReportingHTTPHandler *bb_otel.ActiveSpansReportingHTTPHandler
grpcClientFactory bb_grpc.ClientFactory
}

// MarkReadyAndWait can be called to report that the program has started
// successfully. The application should now be reported as being healthy
// and ready, and receive incoming requests if applicable.
func (ls *LifecycleState) MarkReadyAndWait(group program.Group, grpcClientFactory bb_grpc.ClientFactory) {
func (ls *LifecycleState) MarkReadyAndWait(group program.Group) {
// Start a diagnostics web server that exposes Prometheus
// metrics and provides a health check endpoint.
if ls.config != nil {
Expand All @@ -78,7 +79,8 @@ func (ls *LifecycleState) MarkReadyAndWait(group program.Group, grpcClientFactor
ls.config.HttpServers,
bb_http.NewMetricsHandler(router, "Diagnostics"),
group,
grpcClientFactory)
ls.grpcClientFactory,
)
}
}

Expand Down Expand Up @@ -356,15 +358,19 @@ func ApplyConfiguration(configuration *pb.Configuration) (*LifecycleState, bb_gr
}()
}

grpcClientFactory := bb_grpc.NewDeduplicatingClientFactory(
bb_grpc.NewBaseClientFactory(
grpcClientDialer,
grpcUnaryInterceptors,
grpcStreamInterceptors,
),
)
return &LifecycleState{
config: configuration.GetDiagnosticsHttpServer(),
activeSpansReportingHTTPHandler: activeSpansReportingHTTPHandler,
grpcClientFactory: grpcClientFactory,
},
bb_grpc.NewDeduplicatingClientFactory(
bb_grpc.NewBaseClientFactory(
grpcClientDialer,
grpcUnaryInterceptors,
grpcStreamInterceptors)),
grpcClientFactory,
nil
}

Expand Down

0 comments on commit 85aafcb

Please sign in to comment.