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 23
23
RequestCancellationException
24
24
RequestTimeoutException)
25
25
(io.aleph.dirigiste Pools)
26
+ (io.netty.channel ConnectTimeoutException)
26
27
(io.netty.handler.codec Headers)
27
28
(io.netty.handler.codec.http HttpHeaders)
28
29
(java.net
396
397
(-> (first conn)
397
398
(maybe-timeout! connection-timeout)
398
399
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)))))
403
412
404
413
; ; actually make the request now
405
414
(d/chain'
Original file line number Diff line number Diff line change 31
31
ChannelHandlerContext
32
32
ChannelOutboundHandlerAdapter
33
33
ChannelPipeline
34
- ChannelPromise
35
- ConnectTimeoutException)
34
+ ChannelPromise)
36
35
(io.netty.handler.codec TooLongFrameException)
37
36
(io.netty.handler.codec.compression
38
37
CompressionOptions
638
637
(deftest test-pool-connect-timeout
639
638
(binding [*connection-options* {:connect-timeout 2 }]
640
639
(with-handler basic-handler
641
- (is (thrown? ConnectTimeoutException
640
+ (is (thrown? ConnectionTimeoutException
642
641
(deref (http/get " http://192.0.2.0" ; ; "TEST-NET" in RFC 5737
643
642
(merge (default-request-options ) {:pool *pool*
644
643
:connection-timeout 500 }))
You can’t perform that action at this time.
0 commit comments