Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Feb 16, 2024
1 parent a77e676 commit d31d626
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/clojure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ jobs:
- uses: actions/[email protected]
- 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
Expand Down
4 changes: 2 additions & 2 deletions src/diehard/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions test/diehard/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion test/diehard/rate_limiter_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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))))))

0 comments on commit d31d626

Please sign in to comment.