ignore scoped backends when unscoped limit class in limit action (#606)

This commit is contained in:
Michael Quigley 2024-06-07 12:01:11 -04:00
parent aee973379c
commit efd16c2760
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 7 additions and 0 deletions

View File

@ -32,6 +32,7 @@ func (a *limitAction) HandleAccount(acct *store.Account, _, _ int64, bwc store.B
}
ignoreBackends := ul.ignoreBackends(bwc)
logrus.Warnf("ignore backends excluding '%v': %v", bwc, ignoreBackends)
for _, env := range envs {
shrs, err := a.str.FindSharesForEnvironment(env.Id, trx)
if err != nil {

View File

@ -35,6 +35,12 @@ func (ul *userLimits) ignoreBackends(bwc store.BandwidthClass) map[sdk.BackendMo
}
}
return ignoreBackends
} else {
ignoreBackends := make(map[sdk.BackendMode]bool)
for backendMode := range ul.scopes {
ignoreBackends[backendMode] = true
}
return ignoreBackends
}
return nil
}