diff --git a/CHANGELOG.md b/CHANGELOG.md index a946c9a1..5d4a0c8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ A preview of the next release can be installed from ## Unreleased - Bump babashka.http-client to v0.4.15 +- [#1619](https://github.com/babashka/babashka/issues/1619): Fix reflection issue with `Thread/sleep` in `core.async/timeout` ## 1.3.184 (2023-08-22) diff --git a/src/babashka/impl/clojure/core/async.clj b/src/babashka/impl/clojure/core/async.clj index 3c9cde05..a8f66ceb 100644 --- a/src/babashka/impl/clojure/core/async.clj +++ b/src/babashka/impl/clojure/core/async.clj @@ -6,6 +6,8 @@ [sci.impl.copy-vars :refer [macrofy]] [sci.impl.vars :as vars])) +(set! *warn-on-reflection* true) + (def ^java.util.concurrent.Executor executor @#'async/thread-macro-executor) (def ^java.util.concurrent.Executor virtual-executor @@ -72,7 +74,7 @@ (if virtual-executor (let [chan (async/chan nil)] (.execute virtual-executor (fn [] - (Thread/sleep ms) + (Thread/sleep (long ms)) (async/close! chan))) chan) (async/timeout ms))) diff --git a/test/babashka/async_test.clj b/test/babashka/async_test.clj index 7fd1050c..770ac9aa 100644 --- a/test/babashka/async_test.clj +++ b/test/babashka/async_test.clj @@ -42,3 +42,11 @@ [(async/go (async/