diff --git a/CHANGELOG.md b/CHANGELOG.md index 335c837..956dd6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ # Changelog # - ## Version 12.0.xxx - Add integration with StructuredTaskScope (Structured Concurrency) - Remove deprecated executors constructors (deprecated in v9) +- Add default-on-timeout arity for `p/await` and `p/await!`. +- Add helper for properly unwrap concurrent exceptions: `pu/unwrap-exception` BREAKING CHANGES: diff --git a/src/promesa/core.cljc b/src/promesa/core.cljc index 4ade194..a726cf0 100644 --- a/src/promesa/core.cljc +++ b/src/promesa/core.cljc @@ -779,10 +779,12 @@ ([resource] (pt/-await! resource)) ([resource duration] + (await! resource duration nil)) + ([resource duration default-on-timeout] (try (pt/-await! resource duration) (catch TimeoutException _ - nil))))) + default-on-timeout))))) #?(:clj (defn await @@ -798,10 +800,12 @@ (catch Throwable cause cause))) ([resource duration] + (await resource duration nil)) + ([resource duration default-on-timeout] (try (pt/-await! resource duration) (catch TimeoutException _ - nil) + default-on-timeout) (catch InterruptedException cause (throw cause)) (catch Throwable cause diff --git a/src/promesa/util.cljc b/src/promesa/util.cljc index 8ac0a8c..18b5b04 100644 --- a/src/promesa/util.cljc +++ b/src/promesa/util.cljc @@ -178,7 +178,7 @@ (-closed? [it] (.isShutdown it)) (-close! [it] - (.close it)) + (.close ^java.lang.AutoCloseable it)) java.lang.AutoCloseable (-closed? [_]