Skip to content

Commit 012121e

Browse files
committed
update func docstring
Signed-off-by: Walther Lee <[email protected]>
1 parent 1a1ca73 commit 012121e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/metricshandler/metrics_handler.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func New(opts *options.Options, kubeClient kubernetes.Interface, storeBuilder ks
6969
}
7070
}
7171

72-
// ReconfigureSharding reconfigures sharding with the current shard and totalShards, and
73-
// it's a no-op if both values are 0.
72+
// BuildWriters builds the metrics writers, cancelling any previous context and passing a new one on every build.
73+
// Build can be used mutlitple times and concurrently.
7474
func (m *MetricsHandler) BuildWriters(ctx context.Context) {
7575
m.mtx.Lock()
7676
defer m.mtx.Unlock()
@@ -94,8 +94,9 @@ func (m *MetricsHandler) ConfigureSharding(ctx context.Context, shard int32, tot
9494
m.curShard = shard
9595
m.curTotalShards = totalShards
9696
m.storeBuilder.WithSharding(shard, totalShards)
97-
m.mtx.Unlock()
9897

98+
// unlock because BuildWriters will hold a lock again
99+
m.mtx.Unlock()
99100
m.BuildWriters(ctx)
100101
}
101102

0 commit comments

Comments
 (0)