naming lint; streamlining limits agent processing (#606)

This commit is contained in:
Michael Quigley 2024-06-04 10:33:39 -04:00
parent db71e06610
commit 9a84975b4a
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
4 changed files with 15 additions and 15 deletions

View File

@ -33,9 +33,9 @@ func NewAgent(cfg *Config, ifxCfg *metrics.InfluxConfig, zCfg *zrokEdgeSdk.Confi
zCfg: zCfg, zCfg: zCfg,
str: str, str: str,
queue: make(chan *metrics.Usage, 1024), queue: make(chan *metrics.Usage, 1024),
warningActions: []AccountAction{newAccountWarningAction(emailCfg, str)}, warningActions: []AccountAction{newWarningAction(emailCfg, str)},
limitActions: []AccountAction{newAccountLimitAction(str, zCfg)}, limitActions: []AccountAction{newLimitAction(str, zCfg)},
relaxActions: []AccountAction{newAccountRelaxAction(str, zCfg)}, relaxActions: []AccountAction{newRelaxAction(str, zCfg)},
close: make(chan struct{}), close: make(chan struct{}),
join: make(chan struct{}), join: make(chan struct{}),
} }

View File

@ -8,16 +8,16 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
type accountLimitAction struct { type limitAction struct {
str *store.Store str *store.Store
zCfg *zrokEdgeSdk.Config zCfg *zrokEdgeSdk.Config
} }
func newAccountLimitAction(str *store.Store, zCfg *zrokEdgeSdk.Config) *accountLimitAction { func newLimitAction(str *store.Store, zCfg *zrokEdgeSdk.Config) *limitAction {
return &accountLimitAction{str, zCfg} return &limitAction{str, zCfg}
} }
func (a *accountLimitAction) HandleAccount(acct *store.Account, _, _ int64, _ *BandwidthPerPeriod, trx *sqlx.Tx) error { func (a *limitAction) HandleAccount(acct *store.Account, _, _ int64, _ *BandwidthPerPeriod, trx *sqlx.Tx) error {
logrus.Infof("limiting '%v'", acct.Email) logrus.Infof("limiting '%v'", acct.Email)
envs, err := a.str.FindEnvironmentsForAccount(acct.Id, trx) envs, err := a.str.FindEnvironmentsForAccount(acct.Id, trx)

View File

@ -10,16 +10,16 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
type accountRelaxAction struct { type relaxAction struct {
str *store.Store str *store.Store
zCfg *zrokEdgeSdk.Config zCfg *zrokEdgeSdk.Config
} }
func newAccountRelaxAction(str *store.Store, zCfg *zrokEdgeSdk.Config) *accountRelaxAction { func newRelaxAction(str *store.Store, zCfg *zrokEdgeSdk.Config) *relaxAction {
return &accountRelaxAction{str, zCfg} return &relaxAction{str, zCfg}
} }
func (a *accountRelaxAction) HandleAccount(acct *store.Account, _, _ int64, _ *BandwidthPerPeriod, trx *sqlx.Tx) error { func (a *relaxAction) HandleAccount(acct *store.Account, _, _ int64, _ *BandwidthPerPeriod, trx *sqlx.Tx) error {
logrus.Infof("relaxing '%v'", acct.Email) logrus.Infof("relaxing '%v'", acct.Email)
envs, err := a.str.FindEnvironmentsForAccount(acct.Id, trx) envs, err := a.str.FindEnvironmentsForAccount(acct.Id, trx)

View File

@ -9,16 +9,16 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
type accountWarningAction struct { type warningAction struct {
str *store.Store str *store.Store
cfg *emailUi.Config cfg *emailUi.Config
} }
func newAccountWarningAction(cfg *emailUi.Config, str *store.Store) *accountWarningAction { func newWarningAction(cfg *emailUi.Config, str *store.Store) *warningAction {
return &accountWarningAction{str, cfg} return &warningAction{str, cfg}
} }
func (a *accountWarningAction) HandleAccount(acct *store.Account, rxBytes, txBytes int64, limit *BandwidthPerPeriod, _ *sqlx.Tx) error { func (a *warningAction) HandleAccount(acct *store.Account, rxBytes, txBytes int64, limit *BandwidthPerPeriod, _ *sqlx.Tx) error {
logrus.Infof("warning '%v'", acct.Email) logrus.Infof("warning '%v'", acct.Email)
if a.cfg != nil { if a.cfg != nil {