File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
service/sharddistributor/canary Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 11package canary
22
33import (
4- "context"
5-
64 "go.uber.org/fx"
75 "go.uber.org/yarpc"
86
@@ -84,13 +82,11 @@ func opts(names NamespacesNames) fx.Option {
8482 )),
8583 fx .Provide (sharddistributorv1 .NewFxShardDistributorExecutorCanaryAPIYARPCProcedures ()),
8684
87- fx .Invoke (func (lc fx.Lifecycle , chooser spectatorclient.SpectatorPeerChooserInterface , spectators * spectatorclient.Spectators ) {
88- lc .Append (fx.Hook {
89- OnStart : func (ctx context.Context ) error {
90- chooser .SetSpectators (spectators )
91- return nil
92- },
93- })
85+ // There is a circular dependency between the spectator client and the peer chooser, since
86+ // the yarpc dispatcher needs the peer chooser and the peer chooser needs the spectators, which needs the yarpc dispatcher.
87+ // To break the circular dependency, we set the spectators on the peer chooser here.
88+ fx .Invoke (func (chooser spectatorclient.SpectatorPeerChooserInterface , spectators * spectatorclient.Spectators ) {
89+ chooser .SetSpectators (spectators )
9490 }),
9591 )
9692}
You can’t perform that action at this time.
0 commit comments