aleph

valerauko 2019-03-27T09:32:11.025300Z

is anyone using new relic with aleph?

pithyless 2019-03-27T13:58:02.025800Z

@vale You may want to ask @seancorfield (who is not in this channel) if you have questions about instrumenting NewRelic.

👍 1
igrishaev 2019-03-27T14:29:32.026100Z

Hi! When sending an HTTP request with aleph, I prefer to wrap http/get into a future. This is to catch some possible exceptions related to a malformed URL, for example. One of my teammates noticed that such a structure consumes two threads that probably leads to a bottleneck. It it really so?

clojure
(->

  (d/future
    (http/get url))

  (d/chain

   (fn [response]
     (let [{:keys [headers]} response
           content-length (get headers "content-length")]
       ...)))

  (d/catch
   (fn [^Exception e]
     ...)))

mccraigmccraig 2019-03-27T23:42:43.031300Z

@igrishaev http/get is non-blocking, while d/future uses a thread, so isn't a good wrapper for http/get. if you are seeing exceptions before the first callback of http/get, what I've done in similar circumstances is use a macro which wraps its body in a d/catch and a try ... catch and ensures you always get a Deferred result

mccraigmccraig 2019-03-27T23:43:45.032Z

I'm afk atm, I'll try and post some code tomorrow if that would be helpful