mirror of https://github.com/yunginnanet/Rate5
Fix: only print if we enabled
This commit is contained in:
parent
d7d8a0ce87
commit
693cbf2c84
5
debug.go
5
debug.go
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue