| 495 | } |
| 496 | |
| 497 | func (l *Limits) hasQueryAttributeRegexChanged() bool { |
| 498 | var newHash uint64 |
| 499 | h := xxhash.New() |
| 500 | |
| 501 | if l.QueryPriority.Enabled { |
| 502 | for _, priority := range l.QueryPriority.Priorities { |
| 503 | for _, attribute := range priority.QueryAttributes { |
| 504 | addToHash(h, attribute.Regex) |
| 505 | addToHash(h, attribute.UserAgentRegex) |
| 506 | } |
| 507 | } |
| 508 | } |
| 509 | if l.QueryRejection.Enabled { |
| 510 | for _, attribute := range l.QueryRejection.QueryAttributes { |
| 511 | addToHash(h, attribute.Regex) |
| 512 | addToHash(h, attribute.UserAgentRegex) |
| 513 | } |
| 514 | } |
| 515 | |
| 516 | newHash = h.Sum64() |
| 517 | |
| 518 | if newHash != l.queryAttributeRegexHash { |
| 519 | l.queryAttributeRegexHash = newHash |
| 520 | return true |
| 521 | } |
| 522 | return false |
| 523 | } |
| 524 | |
| 525 | func addToHash(h *xxhash.Digest, regex string) { |
| 526 | if regex == "" { |