Add nil check for quota manager (#9379)
* Add nil check for quota manager * Add missing nil checks
This commit is contained in:
parent
cf94e19b03
commit
f1534a0ed0
|
@ -339,9 +339,11 @@ func (c *Core) disableCredentialInternal(ctx context.Context, path string, updat
|
|||
|
||||
removePathCheckers(c, entry, viewPath)
|
||||
|
||||
if err := c.quotaManager.HandleBackendDisabling(ctx, ns.Path, path); err != nil {
|
||||
c.logger.Error("failed to update quotas after disabling auth", "path", path, "error", err)
|
||||
return err
|
||||
if c.quotaManager != nil {
|
||||
if err := c.quotaManager.HandleBackendDisabling(ctx, ns.Path, path); err != nil {
|
||||
c.logger.Error("failed to update quotas after disabling auth", "path", path, "error", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if c.logger.IsInfo() {
|
||||
|
|
|
@ -1838,8 +1838,10 @@ func (c *Core) sealInternalWithOptions(grabStateLock, keepHALock, performCleanup
|
|||
}
|
||||
}
|
||||
|
||||
if err := c.quotaManager.Reset(); err != nil {
|
||||
c.logger.Error("error resetting quota manager", "error", err)
|
||||
if c.quotaManager != nil {
|
||||
if err := c.quotaManager.Reset(); err != nil {
|
||||
c.logger.Error("error resetting quota manager", "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
postSealInternal(c)
|
||||
|
@ -2526,11 +2528,19 @@ func (c *Core) setupQuotas(ctx context.Context, isPerfStandby bool) error {
|
|||
// ApplyRateLimitQuota checks the request against all the applicable quota rules
|
||||
func (c *Core) ApplyRateLimitQuota(req *quotas.Request) (quotas.Response, error) {
|
||||
req.Type = quotas.TypeRateLimit
|
||||
return c.quotaManager.ApplyQuota(req)
|
||||
if c.quotaManager != nil {
|
||||
return c.quotaManager.ApplyQuota(req)
|
||||
}
|
||||
|
||||
return quotas.Response{Allowed: true}, nil
|
||||
}
|
||||
|
||||
// RateLimitAuditLoggingEnabled returns if the quota configuration allows audit
|
||||
// logging of request rejections due to rate limiting quota rule violations.
|
||||
func (c *Core) RateLimitAuditLoggingEnabled() bool {
|
||||
return c.quotaManager.RateLimitAuditLoggingEnabled()
|
||||
if c.quotaManager != nil {
|
||||
return c.quotaManager.RateLimitAuditLoggingEnabled()
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -664,9 +664,11 @@ func (c *Core) unmountInternal(ctx context.Context, path string, updateStorage b
|
|||
|
||||
removePathCheckers(c, entry, viewPath)
|
||||
|
||||
if err := c.quotaManager.HandleBackendDisabling(ctx, ns.Path, path); err != nil {
|
||||
c.logger.Error("failed to update quotas after disabling mount", "path", path, "error", err)
|
||||
return err
|
||||
if c.quotaManager != nil {
|
||||
if err := c.quotaManager.HandleBackendDisabling(ctx, ns.Path, path); err != nil {
|
||||
c.logger.Error("failed to update quotas after disabling mount", "path", path, "error", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if c.logger.IsInfo() {
|
||||
|
|
Loading…
Reference in New Issue