【问题标题】:Timbre(Clojure), it takes one minute to finishTimbre(Clojure),需要一分钟才能完成
【发布时间】:2014-04-04 08:16:48
【问题描述】:

当我运行以下简单程序时,打印“信息后”消息后需要一分钟才能完成。

$ lein run -m logger.core

(ns logger.core
  (:require [taoensso.timbre :as timbre]))

(defn -main []
  (println "before info")
  (timbre/info "hello world")
  (println "after info"))

如果我将(timbre/info "hello world") 注释掉,这种浪费时间就完全消失了。

是什么原因?我该如何避免这种情况?

提前致谢。

【问题讨论】:

    标签: clojure leiningen timbre


    【解决方案1】:

    您需要关闭代理。

    (ns logger.core
      (:require [taoensso.timbre :as timbre]))
    
    (defn -main []
      (println "before info")
      (timbre/info "hello world")
      (shutdown-agents)
      (println "after info"))
    

    【讨论】:

    • 谢谢。我可以避免这种情况。
    【解决方案2】:

    因为 Leiningen 很可能也在编译 Timbre 库及其所有依赖项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-15
      • 1970-01-01
      • 1970-01-01
      • 2019-11-21
      • 2013-05-08
      • 2018-05-20
      相关资源
      最近更新 更多