Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolves reflection warnings #68

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/diehard/circuit_breaker.clj
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ on current state:
* `:close` allows all executions
* `:half-open` only allows some of execution requests"
[^CircuitBreaker cb]
(.allowsExecution cb))
(.tryAcquirePermit cb))
6 changes: 3 additions & 3 deletions src/diehard/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

(defn ^:no-doc retry-policy-from-config [policy-map]
(let [policy (if-let [policy (:policy policy-map)]
(RetryPolicy/builder (.getConfig policy))
(RetryPolicy/builder (.getConfig ^RetryPolicy policy))
(RetryPolicy/builder))]

(when (contains? policy-map :abort-if)
Expand All @@ -80,8 +80,8 @@
(let [backoff-config (:backoff-ms policy-map)
[delay max-delay multiplier] backoff-config]
(if (nil? multiplier)
(.withBackoff policy delay max-delay ChronoUnit/MILLIS)
(.withBackoff policy delay max-delay ChronoUnit/MILLIS multiplier))))
(.withBackoff policy ^long delay ^long max-delay ChronoUnit/MILLIS)
(.withBackoff policy ^long delay ^long max-delay ChronoUnit/MILLIS ^double multiplier))))
(when-let [delay (:delay-ms policy-map)]
(.withDelay policy (Duration/ofMillis delay)))
(when-let [duration (:max-duration-ms policy-map)]
Expand Down
4 changes: 2 additions & 2 deletions src/diehard/rate_limiter.clj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(acquire! [this permits]
(let [sleep (do-acquire this permits)]
(when (> sleep 0)
(Thread/sleep sleep))))
(Thread/sleep ^long sleep))))
(try-acquire [this]
(try-acquire this 1))
(try-acquire [this permits]
Expand All @@ -42,7 +42,7 @@
false
(do
(when (> sleep 0)
(Thread/sleep sleep))
(Thread/sleep ^long sleep))
true)))))

(defn- refill [^TokenBucketRateLimiter rate-limiter]
Expand Down