File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 2323 RequestCancellationException
2424 RequestTimeoutException)
2525 (io.aleph.dirigiste Pools)
26+ (io.netty.channel ConnectTimeoutException)
2627 (io.netty.handler.codec Headers)
2728 (io.netty.handler.codec.http HttpHeaders)
2829 (java.net
396397 (-> (first conn)
397398 (maybe-timeout! connection-timeout)
398399
399- ; ; connection timeout triggered
400- (d/catch' TimeoutException
401- (fn [^Throwable e]
402- (d/error-deferred (ConnectionTimeoutException. e))))
400+ ; ; connection establishment failed
401+ (d/catch'
402+ (fn [e]
403+ (if (or (instance? TimeoutException e)
404+ ; ; Unintuitively, this type doesn't inherit from TimeoutException
405+ (instance? ConnectTimeoutException e))
406+ (do
407+ (log/error e " Timed out waiting for connection to be established" )
408+ (d/error-deferred (ConnectionTimeoutException. ^Throwable e)))
409+ (do
410+ (log/error e " Connection failure" )
411+ (d/error-deferred e)))))
403412
404413 ; ; actually make the request now
405414 (d/chain'
Original file line number Diff line number Diff line change 3131 ChannelHandlerContext
3232 ChannelOutboundHandlerAdapter
3333 ChannelPipeline
34- ChannelPromise
35- ConnectTimeoutException)
34+ ChannelPromise)
3635 (io.netty.handler.codec TooLongFrameException)
3736 (io.netty.handler.codec.compression
3837 CompressionOptions
638637(deftest test-pool-connect-timeout
639638 (binding [*connection-options* {:connect-timeout 2 }]
640639 (with-handler basic-handler
641- (is (thrown? ConnectTimeoutException
640+ (is (thrown? ConnectionTimeoutException
642641 (deref (http/get " http://192.0.2.0" ; ; "TEST-NET" in RFC 5737
643642 (merge (default-request-options ) {:pool *pool*
644643 :connection-timeout 500 }))
You can’t perform that action at this time.
0 commit comments