perf: optimize LRU access in keep-alive (#1316)

This commit is contained in:
ysj16 2020-06-12 05:24:50 +08:00 committed by GitHub
parent 0b93440146
commit 1f2926a33c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,7 +226,7 @@ const KeepAliveImpl = {
keys.add(key)
// prune oldest entry
if (max && keys.size > parseInt(max as string, 10)) {
pruneCacheEntry(Array.from(keys)[0])
pruneCacheEntry(keys.values().next().value)
}
}
// avoid vnode being unmounted