This commit is contained in:
Michiel Borkent 2020-05-20 22:56:32 +02:00
parent 5a2f68c1ea
commit 9d4b853e8f
2 changed files with 8 additions and 5 deletions

View file

@ -348,8 +348,7 @@ function to invoke a pod var with callbacks.
The arguments to `babashka.pods/invoke` are:
- a pod identifier string, either explicitly set as `pod-id` in `describe`, or
derived from the first described namespace.
- a pod identifier string derived from the first described namespace.
- the symbol of the var to invoke
- the arguments to the var
- an opts map containing `:handler` containing callback functions: `:success`, `:error` and `:done`

View file

@ -69,6 +69,9 @@
promise? (instance? clojure.lang.IPending chan)
exception (when (and promise? error?)
(ex-info ex-message ex-data))
;; NOTE: if we need more fine-grained handlers, we will add
;; a :raw handler that will just get the bencode message's raw
;; data
{error-handler :error
done-handler :done
success-handler :success} (when (map? chan)
@ -165,7 +168,7 @@
reply (read stdout)
format (-> (get reply "format") bytes->string keyword)
ops (some->> (get reply "ops") keys (map keyword) set)
pod-id (get-maybe-string reply "pod-id")
;; pod-id (get-maybe-string reply "pod/id")
pod {:process p
:pod-spec pod-spec
:stdin stdin
@ -178,8 +181,9 @@
:remove-ns remove-ns}
_ (add-shutdown-hook! #(destroy pod))
pod-namespaces (get reply "namespaces")
pod-id (or pod-id (when-let [ns (first pod-namespaces)]
(get-string ns "name")))
pod-id (or (when-let [ns (first pod-namespaces)]
(get-string ns "name"))
(next-id))
pod (assoc pod :pod-id pod-id)
vars-fn (fn [ns-name-str vars]
(reduce