Skip to content

Commit 7a49361

Browse files
committed
Fix ShardCreator to use refactored Spectators type
1 parent 7e00652 commit 7a49361

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

service/sharddistributor/canary/processorephemeral/shardcreator.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const (
2626
type ShardCreator struct {
2727
logger *zap.Logger
2828
timeSource clock.TimeSource
29-
spectators map[string]spectatorclient.Spectator // namespace -> spectator
29+
spectators *spectatorclient.Spectators
3030
canaryClient sharddistributorv1.ShardDistributorExecutorCanaryAPIYARPCClient
3131
namespaces []string
3232

@@ -40,7 +40,7 @@ type ShardCreatorParams struct {
4040

4141
Logger *zap.Logger
4242
TimeSource clock.TimeSource
43-
Spectators map[string]spectatorclient.Spectator
43+
Spectators *spectatorclient.Spectators
4444
CanaryClient sharddistributorv1.ShardDistributorExecutorCanaryAPIYARPCClient
4545
}
4646

@@ -101,11 +101,12 @@ func (s *ShardCreator) process(ctx context.Context) {
101101
s.logger.Info("Creating shard", zap.String("shardKey", shardKey), zap.String("namespace", namespace))
102102

103103
// Get spectator for this namespace
104-
spectator, ok := s.spectators[namespace]
105-
if !ok {
104+
spectator, err := s.spectators.ForNamespace(namespace)
105+
if err != nil {
106106
s.logger.Warn("No spectator for namespace, skipping shard creation",
107107
zap.String("namespace", namespace),
108-
zap.String("shardKey", shardKey))
108+
zap.String("shardKey", shardKey),
109+
zap.Error(err))
109110
continue
110111
}
111112

0 commit comments

Comments
 (0)