pathom

Joel 2023-08-18T02:51:10.931619Z

Is there a way to short-circuit a query? In my case, I’d like to quit sending requests when I’ve found the first match.

2023-08-18T10:59:15.604949Z

Maybe you could add an atom in the query env. The moment one resolver finds something you update it. Other resolvers either dont start or cancel whatever they are doing (via add-watch). Just a vague idea, no idea if feasible

👀 1
wilkerlucio 2023-08-18T12:53:10.398339Z

Im a bit confused here, is this a pathom question or a #datomic question?

wilkerlucio 2023-08-18T12:53:47.855889Z

if its in the pathom context, are we talking about a single attribute, or multiple attributes?

favila 2023-08-18T13:07:39.474619Z

Oh man I assumed it was a datomic question, somehow I missed the channel name. My answer is for datomic. Sorry for the confusion!

Joel 2023-08-18T19:10:52.158179Z

Yes, it was pathom question, thanks for the pointer @jeroenvandijk

👍 1
wilkerlucio 2023-08-18T20:29:22.704239Z

I would be careful with the atom approach, make sure you are not sharing the atom across requests, otherwise you might stop running unrelated requests

wilkerlucio 2023-08-18T20:29:40.278879Z

you can use a plugin to inject an atom, but I still wonder what is the problem you are trying to solve

Joel 2023-08-18T20:44:10.133749Z

Simply performance.

Joel 2023-08-18T20:44:42.203989Z

I think this may fall into the batch processing, I need to take a look at that.

wilkerlucio 2023-08-18T20:44:43.633029Z

but what are you trying to resolve? its a thing cross attributes? a single attribute?

wilkerlucio 2023-08-18T20:45:27.831989Z

because Im hearing so far is things should handle automatically, so I guess Im missing something

Joel 2023-08-18T20:45:49.050119Z

Basically a list that needs to do a look-up for each item in the list, but once it finds a match, it doesn’t need to continue.

wilkerlucio 2023-08-18T20:48:38.254159Z

indeed I think its something you can handle with some work on top of batch resolvers, since there you control the load of the list as a whole

➕ 1
wilkerlucio 2023-08-18T20:49:41.002729Z

but I like to warn you of some implications, like, if you get in a more complex situations and the data is needed for something outside that list, you might end up with missing data

wilkerlucio 2023-08-18T20:50:14.571319Z

I say that because in Pathom 3, the batch is across your whole query (not just a single list), so you have that same need spread across different parts of the query, that still going trigger a single call to the batch resolver

✔️ 1
Joel 2023-08-18T20:52:12.107899Z

Ah, that makes sense, good to know.

favila 2023-08-18T03:32:34.894579Z

d/q and d/query are eager and cannot deliver partial results. The only thing you can do is set a timeout, which will keep it from running forever but won’t give you results if it is exceeded. If you want partial results, use d/datoms, d/seek-index, d/index-pull etc. You can also use d/q but supply it chunks of input. (update: I thought you were asking about datomic! please ignore)