File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 2222 ReadTimeoutException
2323 RequestTimeoutException)
2424 (io.aleph.dirigiste Pools)
25+ (io.netty.channel ConnectTimeoutException)
2526 (io.netty.handler.codec Headers)
2627 (io.netty.handler.codec.http HttpHeaders)
2728 (java.net
384385 (maybe-timeout! connection-timeout)
385386
386387 ; ; connection timeout triggered, dispose of the connetion
387- (d/catch' TimeoutException
388- (fn [^Throwable e]
389- (log/error e " Timed out waiting for connection to be established" )
390- (flow/dispose pool k conn)
391- (d/error-deferred (ConnectionTimeoutException. e))))
392-
393- ; ; connection failed, bail out
394388 (d/catch'
395389 (fn [e]
396- (log/error e " Connection failure" )
397390 (flow/dispose pool k conn)
398- (d/error-deferred e)))
391+ (if (or (instance? TimeoutException e)
392+ ; ; Unintuitively, this type doesn't inherit from TimeoutException
393+ (instance? ConnectTimeoutException e))
394+ (do
395+ (log/error e " Timed out waiting for connection to be established" )
396+ (d/error-deferred (ConnectionTimeoutException. ^Throwable e)))
397+ (do
398+ (log/error e " Connection failure" )
399+ (d/error-deferred e)))))
399400
400401 ; ; actually make the request now
401402 (d/chain'
Original file line number Diff line number Diff line change 2929 ChannelHandlerContext
3030 ChannelOutboundHandlerAdapter
3131 ChannelPipeline
32- ChannelPromise
33- ConnectTimeoutException)
32+ ChannelPromise)
3433 (io.netty.handler.codec TooLongFrameException)
3534 (io.netty.handler.codec.compression
3635 CompressionOptions
637636(deftest test-pool-connect-timeout
638637 (binding [*connection-options* {:connect-timeout 2 }]
639638 (with-handler basic-handler
640- (is (thrown? ConnectTimeoutException
639+ (is (thrown? ConnectionTimeoutException
641640 (deref (http/get " http://192.0.2.0" ; ; "TEST-NET" in RFC 5737
642641 (merge (default-request-options ) {:pool *pool*
643642 :connection-timeout 500 }))
You can’t perform that action at this time.
0 commit comments