Repository navigation
Delayed eviction from LRU - #87
Conversation
5685f97 to
c34d681
Compare
| if self.weights[key] > self.n and key not in self.heavy: | ||
| # weight(value) > n and evicting the key we just inserted failed. | ||
| # Evict the rest of the LRU instead. | ||
| try: | ||
| while len(self.d) > 1: | ||
| self.evict() | ||
| except Exception: | ||
| pass |
There was a problem hiding this comment.
The behaviour implemented by this blurb is very opinable. It's there mostly to retain functional compatibility with main (there are several tests in dask/distributed that rely on this behaviour too).
Ultimately, once we transition to async set, this will become dead code (at least in distributed).
| # If we are evicting a heavy key we just inserted and one of the callbacks | ||
| # fails, put it at the bottom of the LRU instead of the top. This way lighter | ||
| # keys will have a chance to be evicted first and make space. | ||
| self.heavy.discard(key) |
There was a problem hiding this comment.
Again, very opinable behaviour that is here chiefly to retain functional compatibility with main.
c34d681 to
507dcba
Compare
ed3b8a2 to
5562ac2
Compare
milesgranger
left a comment
There was a problem hiding this comment.
From what I see (and understand of zict in general) this looks overall very good to me.
As a side note, I'd still advocate for another name other than calling these things 'thread-safe'. It doesn't seem to use "traditional" thread safety thru locks, atomics or being lock-free thread-safe via inter-thread communication thru queues/channels but rather silently ignoring expected exceptions from threading conflicts. From my current understanding, this doesn't constitute being thread-safe. It appears to be more 'obstruction free thread-able by suppressing expected exceptions; hope your underlying things are thread-safe'.
But I say this as a noob in zict so please disregard if this is not applicable. :)
Please check yourself that your underlying things are thread-safe, in the specific documented methods. |
Uh oh!
There was an error while loading. Please reload this page.