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 4343 :hystrix/timeout-ms 1000
4444 :hystrix/breaker-request-volume 20
4545 :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?})
4748
4849(def ^:private hystrix-keys
4950 (keys hystrix-base-configuration))
108109 (fn [f req]
109110 (if (not-empty (select-keys req hystrix-keys))
110111 (let [req (merge defaults req)
112+ bad-request-pred (:hystrix/bad-request-pred req)
111113 fallback (:hystrix/fallback-fn req)
112114 wrap-exception-response (fn [resp]
113115 ((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)))))
115117 configurator (configurator req)
116118 logging-context (or (MDC/getCopyOfContextMap ) {})
117119 command (proxy [HystrixCommand] [configurator]
Original file line number Diff line number Diff line change 113113 :throw-exceptions false })]
114114 (:status response) => 503 )))
115115
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"
117117 (rest-driven
118118 [{:method :GET
119119 :url " /" }
130130 (http/get url {:throw-exceptions false
131131 :hystrix/command-key command-key}) => (contains {:status 200 }))))
132132
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"
134134 (rest-driven
135135 [{:method :GET
136136 :url " /" }
You can’t perform that action at this time.
0 commit comments