Fork me on GitHub
#datalevin
<
2023-11-30
>
cgrand16:11:31

Hey! Is there some kind of cache on pull selectors? I’m experiencing weird issues where a selector is failing (returning incomplete data), restarting fix the issue but when it occurs it’s very selector specific: any change to the selector fixes it.

Huahai05:12:03

Do we need to cache here? This code is the same as Datascript

cgrand11:12:34

:man-shrugging: I’ll investigate more next week. It’s very bizarre it looks like a combination of state & cache: the pull works until it stops working and once it stops working we can make it work by just modifying the selector (like swapping the order of two attributes). Thus the workaround (changing the cache key) hints to caching but the behavior (pull stopping to work) hints that there’s something stateful directly or indirectly associated with the cache key.

Huahai15:12:40

Right, probably should not cache these

Huahai03:12:02

Removed caching here, as our DB is not immutable.

cgrand21:12:43

I have no clear repro yet (I will certainly revisit it in a couple of weeks). Something crossed my mind today: what if it’s a bug with cycles detection in pull request? (The thing which returns just {:db/id xxx} when the entity is already seen.) this would explain the failure mode. Anyway I hope the bug is gone now that you removed the cache.