From 9a84975b4aa1c418b3d15c31d1210c38fafb9e45 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 4 Jun 2024 10:33:39 -0400 Subject: [PATCH] naming lint; streamlining limits agent processing (#606) --- controller/limits/agent.go | 6 +++--- controller/limits/limitAction.go | 8 ++++---- controller/limits/relaxAction.go | 8 ++++---- controller/limits/warningAction.go | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/controller/limits/agent.go b/controller/limits/agent.go index ff0a5a56..504da8fe 100644 --- a/controller/limits/agent.go +++ b/controller/limits/agent.go @@ -33,9 +33,9 @@ func NewAgent(cfg *Config, ifxCfg *metrics.InfluxConfig, zCfg *zrokEdgeSdk.Confi zCfg: zCfg, str: str, queue: make(chan *metrics.Usage, 1024), - warningActions: []AccountAction{newAccountWarningAction(emailCfg, str)}, - limitActions: []AccountAction{newAccountLimitAction(str, zCfg)}, - relaxActions: []AccountAction{newAccountRelaxAction(str, zCfg)}, + warningActions: []AccountAction{newWarningAction(emailCfg, str)}, + limitActions: []AccountAction{newLimitAction(str, zCfg)}, + relaxActions: []AccountAction{newRelaxAction(str, zCfg)}, close: make(chan struct{}), join: make(chan struct{}), } diff --git a/controller/limits/limitAction.go b/controller/limits/limitAction.go index fe3561bd..d4e5ee05 100644 --- a/controller/limits/limitAction.go +++ b/controller/limits/limitAction.go @@ -8,16 +8,16 @@ import ( "github.com/sirupsen/logrus" ) -type accountLimitAction struct { +type limitAction struct { str *store.Store zCfg *zrokEdgeSdk.Config } -func newAccountLimitAction(str *store.Store, zCfg *zrokEdgeSdk.Config) *accountLimitAction { - return &accountLimitAction{str, zCfg} +func newLimitAction(str *store.Store, zCfg *zrokEdgeSdk.Config) *limitAction { + 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) envs, err := a.str.FindEnvironmentsForAccount(acct.Id, trx) diff --git a/controller/limits/relaxAction.go b/controller/limits/relaxAction.go index d2b32380..db3c33a4 100644 --- a/controller/limits/relaxAction.go +++ b/controller/limits/relaxAction.go @@ -10,16 +10,16 @@ import ( "github.com/sirupsen/logrus" ) -type accountRelaxAction struct { +type relaxAction struct { str *store.Store zCfg *zrokEdgeSdk.Config } -func newAccountRelaxAction(str *store.Store, zCfg *zrokEdgeSdk.Config) *accountRelaxAction { - return &accountRelaxAction{str, zCfg} +func newRelaxAction(str *store.Store, zCfg *zrokEdgeSdk.Config) *relaxAction { + 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) envs, err := a.str.FindEnvironmentsForAccount(acct.Id, trx) diff --git a/controller/limits/warningAction.go b/controller/limits/warningAction.go index 4b2610bf..829f629c 100644 --- a/controller/limits/warningAction.go +++ b/controller/limits/warningAction.go @@ -9,16 +9,16 @@ import ( "github.com/sirupsen/logrus" ) -type accountWarningAction struct { +type warningAction struct { str *store.Store cfg *emailUi.Config } -func newAccountWarningAction(cfg *emailUi.Config, str *store.Store) *accountWarningAction { - return &accountWarningAction{str, cfg} +func newWarningAction(cfg *emailUi.Config, str *store.Store) *warningAction { + 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) if a.cfg != nil {