diff options
Diffstat (limited to 'usagepool.go')
-rw-r--r-- | usagepool.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usagepool.go b/usagepool.go index 6fd48f5b4..96ed0f0ef 100644 --- a/usagepool.go +++ b/usagepool.go @@ -94,8 +94,15 @@ func (up *UsagePool) LoadOrNew(key interface{}, construct Constructor) (value in if err == nil { upv.value = value } else { - // TODO: remove error'ed entries from map upv.err = err + up.Lock() + // this *should* be safe, I think, because we have a + // write lock on upv, but we might also need to ensure + // that upv.err is nil before doing this, since we + // released the write lock on up during construct... + // but then again it's also after midnight... + delete(up.pool, key) + up.Unlock() } upv.Unlock() } |