Fork me on GitHub
#timbre
<
2021-12-21
>
MatthewLisp16:12:53

Hi there I'm currently working with a slack appender for Timbre and it is a async appender. I was reading Timbre's code source, and it uses clojure agents to dispatch the appender function using send-off As i was reading more about clojure agents and send-off function, apparently: "send-off" uses a separate thread pool which can grow as-needed. However, when using this code:

{:enabled?   true
  :async?     true
  :min-level  :report
  :rate-limit nil
  :output-fn :inherit
  :fn
     (fn [{:keys [output_]}]
       (Thread/sleep 5000)
       (println "after sleep\n")}
I see a 5 seconds delay between each println, and this seems to me that, there's no multiple threads here, but only one thread that is acting as a queue. Why is that? Also when i put a`(read-line)`, it blocks forever and the other dispatches never happens. My main concern here is whether this appender will run without issues in production and more importantly, will it degrade my performance ?

Jan K17:12:44

Each agent only gets one thread, that's how they work. The send-off pool grows if there are multiple agents handling send-off actions.

👍 1