fix: #184 ResourceResolverで利用しているCacheManagerで例外が発生した場合にロックが解放されないバグを修正

This commit is contained in:
usbharu 2023-12-03 13:03:45 +09:00
parent 5a77b9e669
commit e1d99b7ea9
1 changed files with 6 additions and 1 deletions

View File

@ -29,7 +29,12 @@ class InMemoryCacheManager : CacheManager {
} }
} }
if (needRunBlock) { if (needRunBlock) {
val processed = block() val processed = try {
block()
} catch (e: Exception) {
cacheKey.remove(key)
throw e
}
if (cacheKey.containsKey(key)) { if (cacheKey.containsKey(key)) {
valueStore[key] = processed valueStore[key] = processed