Skip to content

Commit 332938d

Browse files
committed
Add duration option to await
Signed-off-by: Greg Haskins <[email protected]>
1 parent e0892c5 commit 332938d

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
:cloverage {:runner :eftest
2828
:runner-opts {:multithread? false
2929
:fail-fast? true}
30-
:fail-threshold 92
30+
:fail-threshold 91
3131
:ns-exclude-regex [#"temporal.client.worker"]})

src/temporal/core.clj

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
(:import [io.temporal.workflow Workflow]
55
[java.util.function Supplier]))
66

7+
(defn- ->supplier
8+
[f]
9+
(reify Supplier
10+
(get [_]
11+
(f))))
12+
713
(defn await
814
"Efficiently parks the workflow until 'pred' evaluates to true. Re-evaluates on each state transition"
9-
[pred]
10-
(Workflow/await
11-
(reify Supplier
12-
(get [_]
13-
(pred)))))
15+
([pred]
16+
(Workflow/await (->supplier pred)))
17+
([duration pred]
18+
(Workflow/await duration (->supplier pred))))

0 commit comments

Comments
 (0)