Skip to content

Commit

Permalink
delete config when QPS and concurrency set to 0
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Sep 24, 2024
1 parent edb43c0 commit d03c2f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/ratelimit/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ func UpdateDimensionConfig(cfg *DimensionConfig) Option {
return InAllowList
}
lim, _ := l.limiters.LoadOrStore(label, newLimiter())
return lim.(*limiter).updateDimensionConfig(cfg)
status := lim.(*limiter).updateDimensionConfig(cfg)
if status&QPSDeleted != 0 && status&ConcurrencyDeleted != 0 {
l.limiters.Delete(label)

Check warning on line 83 in pkg/ratelimit/option.go

View check run for this annotation

Codecov / codecov/patch

pkg/ratelimit/option.go#L83

Added line #L83 was not covered by tests
}
return status
}
}

Expand Down

0 comments on commit d03c2f1

Please sign in to comment.