Skip to content

Commit 481f9c6

Browse files
chore(shard-distributor): did some formatting, and use current load instead of new ewma for determinig if it should persist
Signed-off-by: Theis Mathiassen <[email protected]>
1 parent db70702 commit 481f9c6

File tree

1 file changed

+7
-11
lines changed
  • service/sharddistributor/store/etcd/executorstore

1 file changed

+7
-11
lines changed

service/sharddistributor/store/etcd/executorstore/etcdstore.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@ var (
3131
)
3232

3333
type executorStoreImpl struct {
34-
client *clientv3.Client
35-
prefix string
36-
logger log.Logger
37-
shardCache *shardcache.ShardToExecutorCache
38-
timeSource clock.TimeSource
39-
// Max interval (seconds) before we force a shard-stat persist.
40-
maxStatsPersistIntervalSeconds int64
34+
client *clientv3.Client
35+
prefix string
36+
logger log.Logger
37+
shardCache *shardcache.ShardToExecutorCache
38+
timeSource clock.TimeSource
39+
maxStatsPersistIntervalSeconds int64 // Max interval (seconds) before we force a shard-stat persist.
4140
}
4241

4342
// Constants for gating shard statistics writes to reduce etcd load.
@@ -175,10 +174,7 @@ func (s *executorStoreImpl) RecordHeartbeat(ctx context.Context, namespace, exec
175174

176175
func deriveStatsPersistInterval(shardStatsTTL time.Duration) int64 {
177176
ttlSeconds := int64(shardStatsTTL.Seconds())
178-
if ttlSeconds <= 1 {
179-
return 1
180-
}
181-
return ttlSeconds - 1
177+
return max(1, ttlSeconds-1)
182178
}
183179

184180
func (s *executorStoreImpl) recordShardStatistics(ctx context.Context, namespace, executorID string, reported map[string]*types.ShardStatusReport) {

0 commit comments

Comments
 (0)