Fix: only print if we enabled

This commit is contained in:
kayos@tcp.direct 2022-12-21 16:57:47 -08:00
parent d7d8a0ce87
commit 693cbf2c84
Signed by: kayos
GPG Key ID: 4B841471B4BEE979

View File

@ -28,8 +28,9 @@ func (q *Limiter) setDebugEvict() {
func (q *Limiter) SetDebug(on bool) { func (q *Limiter) SetDebug(on bool) {
switch on { switch on {
case true: case true:
atomic.CompareAndSwapUint32(&q.debug, DebugDisabled, DebugEnabled) if atomic.CompareAndSwapUint32(&q.debug, DebugDisabled, DebugEnabled) {
q.debugPrintf("rate5 debug enabled") q.debugPrintf("rate5 debug enabled")
}
case false: case false:
atomic.CompareAndSwapUint32(&q.debug, DebugEnabled, DebugDisabled) atomic.CompareAndSwapUint32(&q.debug, DebugEnabled, DebugDisabled)
} }