diff options
author | bep <bjorn.erik.pedersen@gmail.com> | 2015-04-03 22:16:36 +0300 |
---|---|---|
committer | bep <bjorn.erik.pedersen@gmail.com> | 2015-04-03 22:16:32 +0300 |
commit | bea5feb34d5944e6dfc87dd292a85d100573397a (patch) | |
tree | 0b6172403463cf93a31ee088cbf57947f69a55f3 /helpers | |
parent | 99a18b21fcc2523015c071b8915cae00a83842b5 (diff) |
Return early from DistinctErrorLogger's Printf
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/general.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/helpers/general.go b/helpers/general.go index cf87c04b1..48e7dbd01 100644 --- a/helpers/general.go +++ b/helpers/general.go @@ -162,11 +162,12 @@ type DistinctErrorLogger struct { func (l *DistinctErrorLogger) Printf(format string, v ...interface{}) { logStatement := fmt.Sprintf(format, v...) l.RLock() - logged := l.m[logStatement] - l.RUnlock() - if logged { + if l.m[logStatement] { + l.RUnlock() return } + l.RUnlock() + l.Lock() if !l.m[logStatement] { jww.ERROR.Print(logStatement) |