diff --git a/.github/workflows/clojure.yml b/.github/workflows/clojure.yml index f16af02..935d69a 100644 --- a/.github/workflows/clojure.yml +++ b/.github/workflows/clojure.yml @@ -9,10 +9,13 @@ jobs: - uses: actions/checkout@v4.1.1 - uses: DeLaGuardo/setup-clojure@master with: - cli: 1.11.1.1435 + cli: "latest" + cljfmt: "latest" - uses: DeLaGuardo/setup-clj-kondo@master with: - version: "2023.12.15" + version: "latest" + - name: format + run: cljfmt check - name: lint run: clj-kondo --lint src - name: Run tests diff --git a/src/diehard/core.clj b/src/diehard/core.clj index 7950a24..4243251 100644 --- a/src/diehard/core.clj +++ b/src/diehard/core.clj @@ -460,8 +460,8 @@ You can always check circuit breaker state with (throw e#)) (catch FailsafeException e# (if-let [cause# (.getCause e#)] - (throw cause#) - (throw e#)))))) + (throw cause#) + (throw e#)))))) (defmacro ^{:doc "Create a rate limiter with options. diff --git a/test/diehard/core_test.clj b/test/diehard/core_test.clj index 56dc4e6..ca34a61 100644 --- a/test/diehard/core_test.clj +++ b/test/diehard/core_test.clj @@ -334,14 +334,14 @@ (catch IllegalStateException _ :failure))))) (is (= :open (cb/state test-cb-4))) - - (testing "inner block exception has no cause" - (defcircuitbreaker test-cb {:failure-threshold 2 - :delay-ms 100000}) - (is (thrown? TimeoutExceededException - (with-circuit-breaker test-cb - (with-timeout {:timeout-ms 100} - (Thread/sleep 200)))))))) + + (testing "inner block exception has no cause" + (defcircuitbreaker test-cb {:failure-threshold 2 + :delay-ms 100000}) + (is (thrown? TimeoutExceededException + (with-circuit-breaker test-cb + (with-timeout {:timeout-ms 100} + (Thread/sleep 200)))))))) (deftest opt-eval-count (let [eval-counter (atom 0)] diff --git a/test/diehard/rate_limiter_test.clj b/test/diehard/rate_limiter_test.clj index b71cae1..a82e820 100644 --- a/test/diehard/rate_limiter_test.clj +++ b/test/diehard/rate_limiter_test.clj @@ -39,4 +39,4 @@ (let [variance (Math/abs (- @counter (* rate time-secs)))] (t/is (<= variance ;; error tolerance: 0.5 -- larger, because we are dealing with slower ticks - 0.5)))))) + 0.5))))))