fix resource manager dead lock (#2302)

Co-authored-by: sado <liaoyonglin@bilibili.com>
This commit is contained in:
sado
2022-08-26 20:07:25 +08:00
committed by GitHub
parent 36678f9023
commit bebf6322ff
2 changed files with 7 additions and 1 deletions

View File

@@ -57,8 +57,8 @@ func (manager *ResourceManager) GetResource(key string, create func() (io.Closer
}
manager.lock.Lock()
defer manager.lock.Unlock()
manager.resources[key] = resource
manager.lock.Unlock()
return resource, nil
})