 
 (def wait-tries (Integer/parseInt (env :wait-tries "30")))
 (def wait-per-try (Integer/parseInt (env :wait-per-try "100")))
+(def wait-emit-msg (Integer/parseInt (env :wait-emit-msg "5000")))
+
+(def every-count-tries-emit (int (/ wait-emit-msg wait-per-try)))
 
 (defmacro is-submap
   [expected actual]


(defn wait-for-metadata-key
  ([id k]
   (wait-for-metadata-key id k wait-tries nil))
  ([id k tries lr]
   (if (pos? tries)
     (let [md (get-metadata id)]
       (if-not (get-in md [:body k])
         (do
           (Thread/sleep wait-per-try)
           (recur id k (dec tries) md))
         md))
     (throw (Exception. (str "Metadata key never appeared: " k ". Response: " lr))))))


                                          :decode t/read-handlers}})]
       (if (= 404 (:status md))
         (do
           (when (zero? (mod cnt every-count-tries-emit))
             (prn (str "Waited " cnt " times for " url)))
           (Thread/sleep wait-per-try)
           (recur url tries (inc cnt) md))
         md))
     last-result)))

