Commit 36d06aee authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Add check for status equality in EnableBlackWhiteList method

- Introduce a condition to prevent unnecessary operations if the requested status matches the current status in the EnableBlackWhiteList method.
- Enhance the efficiency of the WAF service by avoiding redundant updates.
parent ea3f9d66
...@@ -1119,6 +1119,10 @@ func (s *wafService) EnableBlackWhiteList(ctx context.Context, req *MatcherExpr) ...@@ -1119,6 +1119,10 @@ func (s *wafService) EnableBlackWhiteList(ctx context.Context, req *MatcherExpr)
if err != nil { if err != nil {
return err return err
} }
// if status is the same, do nothing
if req.Status == int32(matcherExpr.Status) {
return nil
}
svcMap, err := s.getWafServiceMap(ctx, &MatcherExpr{ svcMap, err := s.getWafServiceMap(ctx, &MatcherExpr{
ID: req.ID, ID: req.ID,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment