Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3: Remove unused mutex in RuleGroup #384

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions rulegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package coraza

import (
"fmt"
"sync"
"time"

"github.com/corazawaf/coraza/v3/internal/strings"
Expand All @@ -18,7 +17,6 @@ import (
// after compilation
type RuleGroup struct {
rules []*Rule
mux *sync.RWMutex
}

// Add a rule to the collection
Expand All @@ -37,10 +35,7 @@ func (rg *RuleGroup) Add(rule *Rule) error {
}

// GetRules returns the slice of rules,
// it's concurrent safe.
func (rg *RuleGroup) GetRules() []*Rule {
rg.mux.RLock()
defer rg.mux.RUnlock()
return rg.rules
}

Expand Down Expand Up @@ -157,6 +152,5 @@ RulesLoop:
func NewRuleGroup() RuleGroup {
return RuleGroup{
rules: []*Rule{},
mux: &sync.RWMutex{},
}
}