Attempted auto workaround for CLJ-124

This commit is contained in:
Peter Taoussanis 2015-05-26 14:20:39 +07:00
parent 371fb24d3f
commit 6ab9c4ac59
2 changed files with 7 additions and 8 deletions

View File

@ -76,14 +76,6 @@ java.lang.Exception: Oh noes
<...>
```
### Timbre slowing down your Clojure app shutdown?
This is due to an outstanding [issue](http://dev.clojure.org/jira/browse/CLJ-124) in Clojure. As a workaround, add the following to your application's startup routine:
```clojure
(.addShutdownHook (Runtime/getRuntime) (Thread. (fn [] (shutdown-agents))))
```
### Configuration
This is the biggest win over Java logging IMO. Here's `timbre/example-config` (also Timbre's default config):

View File

@ -555,3 +555,10 @@
[probability & body]
`(do (assert (<= 0 ~probability 1) "Probability: 0 <= p <= 1")
(when (< (rand) ~probability) ~@body)))
;;;; Shutdown hook ; Workaround for http://dev.clojure.org/jira/browse/CLJ-124
#+clj
(defonce ^:private shutdown-hook
(.addShutdownHook (Runtime/getRuntime)
(Thread. (fn [] (shutdown-agents)))))