`get-hostname`: remove unnecessary promise, add max blocking time

This commit is contained in:
Peter Taoussanis 2014-04-16 15:21:29 +07:00
parent 2cc45e82bf
commit 160102c5d8
1 changed files with 6 additions and 7 deletions

View File

@ -250,13 +250,12 @@
(def ^:private get-hostname (def ^:private get-hostname
(encore/memoize* 60000 (encore/memoize* 60000
(fn [] (fn []
(let [p (promise)] (->
(future ; Android doesn't like this on the main thread (future ; Android doesn't like this on the main thread
(deliver p
(try (.. java.net.InetAddress getLocalHost getHostName) (try (.. java.net.InetAddress getLocalHost getHostName)
(catch java.net.UnknownHostException _ (catch java.net.UnknownHostException _
"UnknownHost")))) "UnknownHost")))
@p)))) (deref 5000 "UnknownHost")))))
(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