This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-29
Channels
- # admin-announcements (4)
- # arachne (19)
- # aws-lambda (3)
- # beginners (10)
- # boot (166)
- # capetown (32)
- # carry (160)
- # cider (5)
- # cljs-dev (5)
- # cljs-edn (19)
- # cljsrn (1)
- # clojure (100)
- # clojure-belgium (2)
- # clojure-dev (8)
- # clojure-greece (13)
- # clojure-new-zealand (12)
- # clojure-poland (1)
- # clojure-russia (93)
- # clojure-sanfrancisco (2)
- # clojure-spec (133)
- # clojure-uk (52)
- # clojurescript (129)
- # cursive (32)
- # datomic (13)
- # defnpodcast (5)
- # devcards (6)
- # dirac (4)
- # emacs (12)
- # euroclojure (5)
- # events (2)
- # hoplon (19)
- # immutant (45)
- # keechma (17)
- # lein-figwheel (27)
- # off-topic (9)
- # om (30)
- # onyx (17)
- # other-languages (3)
- # planck (2)
- # proton (11)
- # re-frame (7)
- # reagent (4)
- # ring (8)
- # sim-testing (2)
- # spacemacs (4)
- # testing (2)
- # untangled (162)
- # utah-clojurians (1)
- # yada (80)
@richiardiandrea: I'm trying to understand what your needs are - would you mind stating your use case?
@tcrawley: thanks for asking but on my side I solved, see snippet above
Yep, I put this in my main and it blocks until the server exits
what is triggering the server to exit? a ^-C? or are you calling web/stop
somewhere?
Yes I call stop as part of the app life cycle, and the start is executed in separate thread
hmm. I'm glad that works for you, but it really shouldn't :) Fns registered with at-exit
will only be called when the JVM exits
Oh, ok...just put a mount defstate and that snippet in the main together with a a mount/start before it
To have the same situation as here
(ns exit.core
(:require [immutant.web :as web])
(:gen-class))
(defn wait-for-close
[]
(let [promise (promise)]
(immutant.util/at-exit #(deliver promise "please shutdown"))
@promise))
(defn -main [& args]
(web/run (fn [req] {:status 200 :body "hi"})
)
(future
(Thread/sleep 5000)
(println "Stopping")
(web/stop))
(wait-for-close)
(println "done"))
So maybe in my case is working because I am also exiting the jvm
I haven't paid attention too much to that distinction until you told me
(ns exit.core
(:require [immutant.web :as web])
(:gen-class))
(defn wait-for-close
[]
(let [promise (promise)]
(immutant.util/at-exit #(do (deliver promise "please shutdown")
(println "AT-EXIT")))
@promise))
(defn -main [& args]
(web/run (fn [req] {:status 200 :body "hi"})
)
(future
(Thread/sleep 5000)
(println "Stopping")
;;(web/stop)
(immutant.util/reset))
(wait-for-close)
(println "done"))
Yes I have to do shutdown-agents as well
immutant.util/reset
is designed for repl use, and basically stops all of the running Immutant services, and triggers all the at-exit
fns
Great good to know
Does it release resources as well? In a reloaded workflow this is important as well...
it should shut down all the various thread pools that any service starts, so you should be good
I mean don't prevent the GC of pools and friends
Great ok
Awesome
Tnx a lot
Could not locate immutang/...
immutang!
i was thinking the drink