Skip to content

Commit a1d6a1b

Browse files
committed
stop app, then shutdown agents in a single hook
1 parent 3e09637 commit a1d6a1b

File tree

2 files changed

+3
-5
lines changed
  • libs
    • deps-template/resources/io/github/kit_clj/kit/src/clj
    • kit-generator/test/resources

2 files changed

+3
-5
lines changed

libs/deps-template/resources/io/github/kit_clj/kit/src/clj/core.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@
4848

4949
(defn -main [& _]
5050
(start-app)
51-
(.addShutdownHook (Runtime/getRuntime) (Thread. stop-app))
52-
(.addShutdownHook (Runtime/getRuntime) (Thread. shutdown-agents)))
51+
(.addShutdownHook (Runtime/getRuntime) (Thread. (fn [] (stop-app) (shutdown-agents)))))

libs/kit-generator/test/resources/core.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@
2828

2929
(defn stop-app []
3030
((or (:stop defaults) (fn [])))
31-
(some-> (deref system) (ig/halt!))
32-
(shutdown-agents))
31+
(some-> (deref system) (ig/halt!)))
3332

3433
(defn start-app [& [params]]
3534
((or (:start params) (:start defaults) (fn [])))
3635
(->> (config/system-config (or (:opts params) (:opts defaults) {}))
3736
(ig/expand)
3837
(ig/init)
3938
(reset! system))
40-
(.addShutdownHook (Runtime/getRuntime) (Thread. stop-app)))
39+
(.addShutdownHook (Runtime/getRuntime) (Thread. (fn [] (stop-app) (shutdown-agents)))))
4140

4241
(defn -main [& _]
4342
(start-app))

0 commit comments

Comments
 (0)