Skip to content

Commit 0c5ed6a

Browse files
committed
Add default-on-timeout arity to await and await! helpers
1 parent 60d3f16 commit 0c5ed6a

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Changelog #
22

3-
43
## Version 12.0.xxx
54

65
- Add integration with StructuredTaskScope (Structured Concurrency)
76
- Remove deprecated executors constructors (deprecated in v9)
7+
- Add default-on-timeout arity for `p/await` and `p/await!`.
8+
- Add helper for properly unwrap concurrent exceptions: `pu/unwrap-exception`
89

910
BREAKING CHANGES:
1011

src/promesa/core.cljc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,10 +779,12 @@
779779
([resource]
780780
(pt/-await! resource))
781781
([resource duration]
782+
(await! resource duration nil))
783+
([resource duration default-on-timeout]
782784
(try
783785
(pt/-await! resource duration)
784786
(catch TimeoutException _
785-
nil)))))
787+
default-on-timeout)))))
786788

787789
#?(:clj
788790
(defn await
@@ -798,10 +800,12 @@
798800
(catch Throwable cause
799801
cause)))
800802
([resource duration]
803+
(await resource duration nil))
804+
([resource duration default-on-timeout]
801805
(try
802806
(pt/-await! resource duration)
803807
(catch TimeoutException _
804-
nil)
808+
default-on-timeout)
805809
(catch InterruptedException cause
806810
(throw cause))
807811
(catch Throwable cause

src/promesa/util.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
(-closed? [it]
179179
(.isShutdown it))
180180
(-close! [it]
181-
(.close it))
181+
(.close ^java.lang.AutoCloseable it))
182182

183183
java.lang.AutoCloseable
184184
(-closed? [_]

0 commit comments

Comments
 (0)