mirror of https://github.com/status-im/timbre.git
core: don't run getHostName on the main thread (AdamClements)
This commit is contained in:
parent
1157a0e97c
commit
b0fef3d5ce
|
@ -211,10 +211,15 @@
|
||||||
(comment ((make-timestamp-fn "yyyy-MMM-dd" nil) (Date.)))
|
(comment ((make-timestamp-fn "yyyy-MMM-dd" nil) (Date.)))
|
||||||
|
|
||||||
(def get-hostname
|
(def get-hostname
|
||||||
(utils/memoize-ttl
|
(utils/memoize-ttl 60000
|
||||||
60000 (fn [] (try (.. java.net.InetAddress getLocalHost getHostName)
|
(fn []
|
||||||
(catch java.net.UnknownHostException _
|
(let [p (promise)]
|
||||||
"UnknownHost")))))
|
(future ; Android doesn't like this on the main thread
|
||||||
|
(deliver p
|
||||||
|
(try (.. java.net.InetAddress getLocalHost getHostName)
|
||||||
|
(catch java.net.UnknownHostException _
|
||||||
|
"UnknownHost"))))
|
||||||
|
@p))))
|
||||||
|
|
||||||
(defn- wrap-appender-juxt
|
(defn- wrap-appender-juxt
|
||||||
"Wraps compile-time appender juxt with additional runtime capabilities
|
"Wraps compile-time appender juxt with additional runtime capabilities
|
||||||
|
|
Loading…
Reference in New Issue