sunng87 / diehard

Clojure resilience library for flexible retry, circuit breaker and rate limiter
Eclipse Public License 2.0
330 stars 27 forks source link

Reflection warnings #67

Closed raszi closed 6 months ago

raszi commented 6 months ago

First of all, thank you for the library!

We can still see some reflection warnings using your library:

Reflection warning, diehard/rate_limiter.clj:34:9 - call to static method sleep on java.lang.Thread can't be resolved (argument types: unknown).
Reflection warning, diehard/rate_limiter.clj:45:13 - call to static method sleep on java.lang.Thread can't be resolved (argument types: unknown).
Reflection warning, diehard/circuit_breaker.clj:78:3 - reference to field allowsExecution on dev.failsafe.CircuitBreaker can't be resolved.
Reflection warning, diehard/core.clj:62:39 - reference to field getConfig can't be resolved.
Reflection warning, diehard/core.clj:83:11 - call to method withBackoff on dev.failsafe.RetryPolicyBuilder can't be resolved (argument types: java.lang.Object, java.lang.Object, java.time.temporal.ChronoUnit).

I believe it would be a good idea to add a call to (set! *warn-on-reflection* true) in the test suite or something like that to avoid regressions.

raszi commented 6 months ago
$ java -version
openjdk version "19.0.2" 2023-01-17
OpenJDK Runtime Environment Temurin-19.0.2+7 (build 19.0.2+7)
OpenJDK 64-Bit Server VM Temurin-19.0.2+7 (build 19.0.2+7, mixed mode)
sunng87 commented 6 months ago

We used to have this global option in lein config. Now in deps.edn there is no alternative way to do so.