Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/manifold/go_off.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
(defn ^:no-doc run-state-machine-wrapped [state]
(try (async-runtime/run-state-machine state)
(catch Throwable ex
(d/error! (async-runtime/aget-object state async-runtime/USER-START-IDX) ex)
(throw ex))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this rethrow the core of the issue?

since you're catching the extremely wide Throwable it'd feel safer to keep the rethrow unless that's what's causing the problem

(d/error! (async-runtime/aget-object state async-runtime/USER-START-IDX) ex))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't used this code in years, can't say I remember why we were re-throwing the original error

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your reply! Alright, I'll try to get to the bottom of this myself then 💪


(defn ^:no-doc take! [state blk d]
(let [handler (fn [x]
Expand Down
8 changes: 4 additions & 4 deletions test/manifold/go_off_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@
(testing "timeouts"
(is (= ::timeout @(go-off (<!? (d/timeout! (d/deferred) 10 ::timeout)))))
(is (= ::timeout @(d/timeout! (go-off (<!? (d/deferred))) 10 ::timeout)))
(is (thrown? TimeoutException @(go-off (<!? (d/timeout! (d/deferred) 10)))))
(is (thrown? TimeoutException @(d/timeout! (go-off (<!? (d/deferred))) 10))))
(is (thrown? TimeoutException @(go-off (<!? (d/timeout! (d/deferred) 11)))))
(is (thrown? TimeoutException @(d/timeout! (go-off (<!? (d/deferred))) 12))))

(testing "alt"
(is (= ::timeout @(go-off (<!? (d/alt (d/deferred) (d/timeout! (d/deferred) 10 ::timeout))))))
(is (= ::timeout @(d/alt (go-off (<!? (d/deferred))) (d/timeout! (d/deferred) 10 ::timeout))))
(is (= ::timeout @(go-off (<!? (d/alt (d/deferred) (d/timeout! (d/deferred) 13 ::timeout))))))
(is (= ::timeout @(d/alt (go-off (<!? (d/deferred))) (d/timeout! (d/deferred) 14 ::timeout))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this change necessary?

(is (= 1 @(go-off (<!? (d/alt (d/deferred) (d/success-deferred 1))))))
(is (= 1 @(d/alt (go-off (<!? (d/deferred))) (d/success-deferred 1))))))

Expand Down