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.)))
|
||||
|
||||
(def get-hostname
|
||||
(utils/memoize-ttl
|
||||
60000 (fn [] (try (.. java.net.InetAddress getLocalHost getHostName)
|
||||
(catch java.net.UnknownHostException _
|
||||
"UnknownHost")))))
|
||||
(utils/memoize-ttl 60000
|
||||
(fn []
|
||||
(let [p (promise)]
|
||||
(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
|
||||
"Wraps compile-time appender juxt with additional runtime capabilities
|
||||
|
|
Loading…
Reference in New Issue