Skip to content

Commit

Permalink
Move assignment and precompute
Browse files Browse the repository at this point in the history
  • Loading branch information
beautifulentropy committed Dec 19, 2024
1 parent 12fb338 commit e4af87b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ratelimits/limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,13 @@ func parseOverrideLimits(newOverridesYAML overridesYAML) (limits, error) {
}

lim := &limit{
burst: v.Burst,
count: v.Count,
period: v.Period,
name: name,
burst: v.Burst,
count: v.Count,
period: v.Period,
name: name,
isOverride: true,
}
lim.precompute()

err := validateLimit(lim)
if err != nil {
Expand All @@ -191,14 +193,12 @@ func parseOverrideLimits(newOverridesYAML overridesYAML) (limits, error) {
return nil, fmt.Errorf(
"validating name %s and id %q for override limit %q: %w", name, id, k, err)
}
lim.isOverride = true
if name == CertificatesPerFQDNSet {
// FQDNSet hashes are not a nice thing to ask for in a
// config file, so we allow the user to specify a
// comma-separated list of FQDNs and compute the hash here.
id = fmt.Sprintf("%x", core.HashNames(strings.Split(id, ",")))
}
lim.precompute()
parsed[joinWithColon(name.EnumString(), id)] = lim
}
}
Expand Down

0 comments on commit e4af87b

Please sign in to comment.