mirror of
https://github.com/coredns/coredns.git
synced 2026-04-05 11:45:33 -04:00
chore: bump golangci-lint to v2.11.4 (#7983)
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
// Erratic is a plugin that returns erratic responses to each client.
|
||||
type Erratic struct {
|
||||
q uint64 // counter of queries
|
||||
q atomic.Uint64 // counter of queries
|
||||
drop uint64
|
||||
delay uint64
|
||||
truncate uint64
|
||||
@@ -29,8 +29,8 @@ func (e *Erratic) ServeDNS(_ctx context.Context, w dns.ResponseWriter, r *dns.Ms
|
||||
delay := false
|
||||
trunc := false
|
||||
|
||||
queryNr := atomic.LoadUint64(&e.q)
|
||||
atomic.AddUint64(&e.q, 1)
|
||||
queryNr := e.q.Load()
|
||||
e.q.Add(1)
|
||||
|
||||
if e.drop > 0 && queryNr%e.drop == 0 {
|
||||
drop = true
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package erratic
|
||||
|
||||
import "sync/atomic"
|
||||
|
||||
// Ready returns true if the number of received queries is in the range [3, 5). All other values return false.
|
||||
// To aid in testing we want to this flip between ready and not ready.
|
||||
func (e *Erratic) Ready() bool {
|
||||
q := atomic.LoadUint64(&e.q)
|
||||
q := e.q.Load()
|
||||
if q >= 3 && q < 5 {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user