jacobobryant / biff

A Clojure web framework for solo developers.
https://biffweb.com
MIT License
878 stars 43 forks source link

Make transaction functions work with subscriptions #102

Closed jacobobryant closed 2 years ago

jacobobryant commented 3 years ago

This expression is supposed to return a list of document ids that have been affected by a given list of transactions (taken from crux.api/open-tx-log): https://github.com/jacobobryant/biff/blob/a42bf75388cf0600120d66fc19b8a201b400d20f/libs/crux/src/biff/crux.clj#L431-L433

However, it only works for put and delete operations. It should recursively check each tx event to see if it's a transaction function, evaluate it if so, and use the results in its place (which might include more tx fn calls).

refset commented 3 years ago

We have some changes coming in https://github.com/juxt/crux/pull/1535 that I think might make this subscription logic much simpler. Specifically, changes to the tx-indexer abstraction that now enable async indexing, e.g. https://github.com/juxt/crux/pull/1535/files#diff-97fb172b1e6d0b14e8f78e6bdcb364d8fef607cf1ad68e42d97e6404744b9e9fR264-R274

/cc @jarohen

jarohen commented 3 years ago

There's a function slightly further up in that PR which may do most of what you want there - https://github.com/juxt/crux/pull/1535/files#diff-97fb172b1e6d0b14e8f78e6bdcb364d8fef607cf1ad68e42d97e6404744b9e9fR215-R233. Funnily enough, I was wondering whether I should make that more available :smile:

jacobobryant commented 3 years ago

Awesome, thanks guys :)

jacobobryant commented 2 years ago

I've fixed this bug by deleting the code which contained it.