Merge pull request #94 from cloudflare/timer-logs

Fix race condition in the matcher code
This commit is contained in:
Łukasz Mierzwa
2017-05-09 17:55:28 +01:00
committed by GitHub
2 changed files with 6 additions and 11 deletions

View File

@@ -23,10 +23,6 @@ type abstractMatcher struct {
Operator string
}
func (matcher *abstractMatcher) setOperator(operator string) {
matcher.Operator = operator
}
func (matcher *abstractMatcher) GetOperator() string {
return matcher.Operator
}
@@ -123,7 +119,6 @@ func (matcher *negativeRegexMatcher) Compare(valA, valB interface{}) bool {
func newMatcher(matchType string) (matcherT, error) {
if m, found := matcherConfig[matchType]; found {
m.setOperator(matchType)
return m, nil
}
e := fmt.Sprintf("%s not matched with any know match type", matchType)

View File

@@ -21,12 +21,12 @@ var matcherRegex = "[=!<>~]+"
var filterRegex = "^(@)?[a-zA-Z_][a-zA-Z0-9_]*"
var matcherConfig = map[string]matcherT{
equalOperator: &equalMatcher{},
notEqualOperator: &notEqualMatcher{},
moreThanOperator: &moreThanMatcher{},
lessThanOperator: &lessThanMatcher{},
regexpOperator: &regexpMatcher{},
negativeRegexOperator: &negativeRegexMatcher{},
equalOperator: &equalMatcher{abstractMatcher{Operator: equalOperator}},
notEqualOperator: &notEqualMatcher{abstractMatcher{Operator: notEqualOperator}},
moreThanOperator: &moreThanMatcher{abstractMatcher{Operator: moreThanOperator}},
lessThanOperator: &lessThanMatcher{abstractMatcher{Operator: lessThanOperator}},
regexpOperator: &regexpMatcher{abstractMatcher{Operator: regexpOperator}},
negativeRegexOperator: &negativeRegexMatcher{abstractMatcher{Operator: negativeRegexOperator}},
}
type filterConfig struct {