From 160102c5d899b10cad99af74308635f64ea68fd6 Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Wed, 16 Apr 2014 15:21:29 +0700 Subject: [PATCH] `get-hostname`: remove unnecessary promise, add max blocking time --- src/taoensso/timbre.clj | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/taoensso/timbre.clj b/src/taoensso/timbre.clj index aada6e7..a8d5491 100644 --- a/src/taoensso/timbre.clj +++ b/src/taoensso/timbre.clj @@ -250,13 +250,12 @@ (def ^:private get-hostname (encore/memoize* 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)))) + (-> + (future ; Android doesn't like this on the main thread + (try (.. java.net.InetAddress getLocalHost getHostName) + (catch java.net.UnknownHostException _ + "UnknownHost"))) + (deref 5000 "UnknownHost"))))) (defn- wrap-appender-juxt "Wraps compile-time appender juxt with additional runtime capabilities