Skip to content

Commit

Permalink
PfacctRateLimitCacheTtl is a string
Browse files Browse the repository at this point in the history
  • Loading branch information
fdurand committed Jan 14, 2025
1 parent 241e393 commit 86b00d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions go/cmd/pfacct/pfacct.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,12 @@ func (pfAcct *PfAcct) SetupConfig(ctx context.Context) {
pfconfigdriver.FetchDecodeSocket(ctx, &RadiusConfiguration)
pfAcct.ProcessBandwidthAcct = sharedutils.IsEnabled(RadiusConfiguration.ProcessBandwidthAccounting)
pfAcct.RateLimit = sharedutils.IsEnabled(RadiusConfiguration.PfacctRateLimit)
pfAcct.PfacctRateLimitCacheTtl = RadiusConfiguration.PfacctRateLimitCacheTtl
pfAcct.RateLimitCache = cache.New(time.Duration(RadiusConfiguration.PfacctRateLimitCacheTtl)*time.Minute, 10*time.Minute)
pfAcct.MacNasCache = cache.New(time.Duration(RadiusConfiguration.PfacctRateLimitCacheTtl)*time.Minute, 10*time.Minute)

pfAcct.PfacctRateLimitCacheTtl = 5
if i, err := strconv.Atoi(RadiusConfiguration.PfacctRateLimitCacheTtl); err != nil {
pfAcct.PfacctRateLimitCacheTtl = i
}
pfAcct.RateLimitCache = cache.New(time.Duration(pfAcct.PfacctRateLimitCacheTtl)*time.Minute, 10*time.Minute)
pfAcct.MacNasCache = cache.New(time.Duration(pfAcct.PfacctRateLimitCacheTtl)*time.Minute, 10*time.Minute)
if !pfAcct.ProcessBandwidthAcct {
logInfo(ctx, "Not processing bandwidth accounting records. To enable set radius_configuration.process_bandwidth_accounting = enabled")
}
Expand Down
2 changes: 1 addition & 1 deletion go/pfconfigdriver/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ type PfConfRadiusConfiguration struct {
PfacctWorkers string `json:"pfacct_workers"`
PfacctWorkQueueSize string `json:"pfacct_work_queue_size"`
PfacctRateLimit string `json:"pfacct_rate_limit"`
PfacctRateLimitCacheTtl int `json:"pfacct_rate_limit_cache_ttl"`
PfacctRateLimitCacheTtl string `json:"pfacct_rate_limit_cache_ttl"`
}

type PfQueueConfig struct {
Expand Down

0 comments on commit 86b00d6

Please sign in to comment.