This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-18
Channels
- # announcements (22)
- # asami (7)
- # babashka (43)
- # beginners (68)
- # biff (2)
- # calva (10)
- # clj-kondo (7)
- # cljdoc (29)
- # clojure (41)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-europe (25)
- # clojure-gamedev (3)
- # clojure-nl (2)
- # clojure-norway (9)
- # clojure-uk (31)
- # clojurescript (3)
- # community-development (7)
- # cursive (3)
- # data-science (4)
- # datomic (17)
- # emacs (30)
- # honeysql (10)
- # hyperfiddle (39)
- # introduce-yourself (1)
- # jobs-discuss (5)
- # kaocha (1)
- # lsp (11)
- # malli (12)
- # pathom (18)
- # pedestal (3)
- # proletarian (2)
- # quil (11)
- # rdf (46)
- # reitit (8)
- # releases (2)
- # shadow-cljs (34)
- # sql (3)
- # squint (10)
- # tools-deps (24)
- # xtdb (10)
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.
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)
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
Im a bit confused here, is this a pathom question or a #C03RZMDSH question?
if its in the pathom context, are we talking about a single attribute, or multiple attributes?
Oh man I assumed it was a datomic question, somehow I missed the channel name. My answer is for datomic. Sorry for the confusion!
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
you can use a plugin to inject an atom, but I still wonder what is the problem you are trying to solve
but what are you trying to resolve? its a thing cross attributes? a single attribute?
because Im hearing so far is things should handle automatically, so I guess Im missing something
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.
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
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
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