File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 43
43
:hystrix/timeout-ms 1000
44
44
:hystrix/breaker-request-volume 20
45
45
:hystrix/breaker-error-percent 50
46
- :hystrix/breaker-sleep-window-ms 5000 })
46
+ :hystrix/breaker-sleep-window-ms 5000
47
+ :hystrix/bad-request-pred client-error?})
47
48
48
49
(def ^:private hystrix-keys
49
50
(keys hystrix-base-configuration))
108
109
(fn [f req]
109
110
(if (not-empty (select-keys req hystrix-keys))
110
111
(let [req (merge defaults req)
112
+ bad-request-pred (:hystrix/bad-request-pred req)
111
113
fallback (:hystrix/fallback-fn req)
112
114
wrap-exception-response (fn [resp]
113
115
((http/wrap-exceptions (constantly resp))
114
- (assoc req :throw-exceptions (not (client-error? req resp)))))
116
+ (assoc req :throw-exceptions (not (bad-request-pred req resp)))))
115
117
configurator (configurator req)
116
118
logging-context (or (MDC/getCopyOfContextMap ) {})
117
119
command (proxy [HystrixCommand] [configurator]
Original file line number Diff line number Diff line change 113
113
:throw-exceptions false })]
114
114
(:status response) => 503 )))
115
115
116
- (fact " errors will not cause circuit to break if client-error? is true, with :throw-exceptions false"
116
+ (fact " errors will not cause circuit to break if bad-request-pred is true, with :throw-exceptions false"
117
117
(rest-driven
118
118
[{:method :GET
119
119
:url " /" }
130
130
(http/get url {:throw-exceptions false
131
131
:hystrix/command-key command-key}) => (contains {:status 200 }))))
132
132
133
- (fact " errors will not cause circuit to break if client-error? is true, with :throw-exceptions true"
133
+ (fact " errors will not cause circuit to break if bad-request-pred is true, with :throw-exceptions true"
134
134
(rest-driven
135
135
[{:method :GET
136
136
:url " /" }
You can’t perform that action at this time.
0 commit comments