Fork me on GitHub
#pathom
<
2023-10-13
>
Pragyan Tripathi11:10:56

While trying out following example from the docs:

(pco/defresolver full-name [{::keys [first-name last-name]}]
  {::full-name (str first-name " " last-name)})

(def env (pci/register full-name))

(p.eql/process env
  [{'(:>/bret {::first-name "Bret" ::last-name "Victor"})
    [::full-name]}])
I get following error:
Execution error (ExceptionInfo) at com.wsscode.pathom3.connect.planner/verify-plan!* (planner.cljc:1694).
; Pathom can't find a path for the following elements in the query: [:com.vadelabs.bridge-restapi.core/full-name] at path [:>/bret]
Any ideas on how to fix it?

Pragyan Tripathi13:10:36

Resolved it. Just needed to install _pbip_/placeholder-data-params plugin.

timovanderkamp11:10:52

Hi, I am trying to parallel process resolvers that take some time to resolve. For some reason when the resolvers have input, they are not being ran in parallel. Is there something that can be done about this? This example takes 1 second to resolve, as expected

(pco/defresolver parallel-1 [_ _]
  {::pco/output [:parallel-1]}
  (p/do!
   (p/delay 1000)
   {:parallel-1 1}))

(pco/defresolver parallel-2 [_ _]
  {::pco/output [:parallel-2]}
  (p/do!
   (p/delay 1000)
   {:parallel-2 2}))

(def p-env (-> {::p.a.eql/parallel? true} (pci/register [parallel-1 parallel-2])))

(comment

 (let [start (js/Date.)]
   (p/then
    (p.a.eql/process p-env [:parallel-1 :parallel-2])
    (fn [res]
      (println res :took (- (.getTime (js/Date.)) start)))))
 )
This example takes 2 seconds to resolve
(pco/defresolver parallel-1 [_ _]
  {::pco/input [:parallel-1/id]
   ::pco/output [:parallel-1/id
                 :parallel-1/value]}
  (p/do!
   (p/delay 1000)
   {:parallel-1/id 1
    :parallel-1/value "value"}))

(pco/defresolver parallel-2 [_ _]
  {::pco/input [:parallel-2/id]
   ::pco/output [:parallel-2/id
                 :parallel-2/value]}
  (p/do!
   (p/delay 1000)
   {:parallel-2/id 2
    :parallel-2/value "value"}))

(def p-env
  (-> {::p.a.eql/parallel? true}
      (pci/register [parallel-1 parallel-2])))

(comment

 (let [start (js/Date.)]
   (p/then
    (p.a.eql/process p-env [{[:parallel-1/id 1] [:parallel-1/value]}
                            {[:parallel-2/id 2] [:parallel-2/value]}])
    (fn [res]
      (println :took (- (.getTime (js/Date.)) start)))))
 )

wilkerlucio16:10:58

thanks for the report, I can confirm its a bug, its not parallelizing the idents

wilkerlucio18:10:36

fixed on main