Closed nornagon closed 1 year ago
Fascinating. I'll dig into this tonight, it's not immediately clear to me why moving the moveToTail to the start of the operation would have that effect, but your test looks valid, so that's likely a good bug, thanks! :)
It’s so that the eviction that happens in addSize will remove the current value last (so hopefully won’t evict the current item, unless its size is larger than the max!)
On Thu, Feb 16, 2023 at 19:09 isaacs @.***> wrote:
Fascinating. I'll dig into this tonight, it's not immediately clear to me why moving the moveToTail to the start of the operation would have that effect, but your test looks valid, so that's likely a good bug, thanks! :)
— Reply to this email directly, view it on GitHub https://github.com/isaacs/node-lru-cache/pull/270#issuecomment-1434035023, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABKGADX3CWNM7SG4GWL5WTWX3TVZANCNFSM6AAAAAAU6VXCMI . You are receiving this because you authored the thread.Message ID: @.***>
--
j
Ah! 🤦 yes. Good catch, thanks. I'll get this in soon.
Published on v7.16.1.
Thanks!
Before this fix, this new test failed with: