Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion service/matching/ratelimit_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ func newRateLimitManager(userDataManager userDataManager,
r.dynamicRateBurst,
config.RateLimiterRefreshInterval,
)

r.mu.Lock()
defer r.mu.Unlock()

// Overall system rate limit will be the min of the two configs that are partition wise times the number of partitons.
var cancel func()
r.adminNsRate, cancel = config.AdminNamespaceToPartitionRateSub(r.setAdminNsRate)
Expand All @@ -90,7 +94,8 @@ func newRateLimitManager(userDataManager userDataManager,
r.cancels = append(r.cancels, cancel)
r.numReadPartitions, cancel = config.NumReadPartitionsSub(r.setNumReadPartitions)
r.cancels = append(r.cancels, cancel)
r.computeEffectiveRPSAndSource()
r.computeEffectiveRPSAndSourceLocked()

return r
}

Expand Down Expand Up @@ -365,7 +370,10 @@ func (r *rateLimitManager) GetFairnessWeightOverrides() fairnessWeightOverrides
}

func (r *rateLimitManager) Stop() {
r.mu.Lock()
defer r.mu.Unlock()
for _, cancel := range r.cancels {
cancel()
}
r.cancels = nil
}
Loading