causalens / dara

Dara is a dynamic application framework designed for creating interactive web apps with ease, all in pure Python.
https://dara.causalens.com
Apache License 2.0
372 stars 8 forks source link

Fix: DO-3618 KeyError in LRU cache #359

Closed krzysztof-causalens closed 1 month ago

krzysztof-causalens commented 1 month ago

Motivation and Context

Issue reported in internal product where in some rare circumstances the LRU code throws a KeyError when evicting an element from the cache store. The exact scenario is unknown, one hypothesis is that there is a threading problem where the LRU uses an async lock which is bypassed by accessing the store in a different thread.

The fix for now is just using pop instead of del to not cause a crash if the deletion fails.

Implementation Description

Any new dependencies Introduced

How Has This Been Tested?

Existing cache store tests passing

PR Checklist:

Screenshots (if appropriate):