Fix destroy
This commit is contained in:
parent
dd46020efc
commit
b81d8b30bf
2 changed files with 7 additions and 6 deletions
|
|
@ -27,4 +27,3 @@ BABASHKA_POD_TEST_SOCKET=true
|
||||||
echo "Testing socket"
|
echo "Testing socket"
|
||||||
clojure -A:test -n babashka.pods.jvm-test
|
clojure -A:test -n babashka.pods.jvm-test
|
||||||
clojure -A:sci:test -n babashka.pods.sci-test
|
clojure -A:sci:test -n babashka.pods.sci-test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,9 @@
|
||||||
(.destroy ^Process (:process pod)))
|
(.destroy ^Process (:process pod)))
|
||||||
(when-let [rns (:remove-ns pod)]
|
(when-let [rns (:remove-ns pod)]
|
||||||
(doseq [[ns-name _] (:namespaces pod)]
|
(doseq [[ns-name _] (:namespaces pod)]
|
||||||
(rns ns-name)))))
|
(rns ns-name))))
|
||||||
|
(swap! pods dissoc pod-id)
|
||||||
|
nil)
|
||||||
|
|
||||||
(def next-pod-id
|
(def next-pod-id
|
||||||
(let [counter (atom 0)]
|
(let [counter (atom 0)]
|
||||||
|
|
@ -298,14 +300,14 @@
|
||||||
:err *err*
|
:err *err*
|
||||||
:remove-ns remove-ns
|
:remove-ns remove-ns
|
||||||
:readers readers}
|
:readers readers}
|
||||||
_ (add-shutdown-hook! #(do
|
|
||||||
(when socket
|
|
||||||
(close-socket socket))
|
|
||||||
(destroy pod)))
|
|
||||||
pod-namespaces (get reply "namespaces")
|
pod-namespaces (get reply "namespaces")
|
||||||
pod-id (or (when-let [ns (first pod-namespaces)]
|
pod-id (or (when-let [ns (first pod-namespaces)]
|
||||||
(get-string ns "name"))
|
(get-string ns "name"))
|
||||||
(next-id))
|
(next-id))
|
||||||
|
_ (add-shutdown-hook! #(do
|
||||||
|
(when socket
|
||||||
|
(close-socket socket))
|
||||||
|
(destroy pod-id)))
|
||||||
pod (assoc pod :pod-id pod-id)
|
pod (assoc pod :pod-id pod-id)
|
||||||
pod-namespaces (mapv #(bencode->namespace pod %)
|
pod-namespaces (mapv #(bencode->namespace pod %)
|
||||||
pod-namespaces)
|
pod-namespaces)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue