Skip to content

Commit

Permalink
Fix supervision when no child filbers are active (#164)
Browse files Browse the repository at this point in the history
* Fix supervision when no child filbers are active

* Fix callback reference
  • Loading branch information
natefaubion authored Mar 25, 2019
1 parent 202a3ea commit b5240af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Effect/Aff.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ var Aff = function () {
},
killAll: function (killError, cb) {
return function () {
if (count === 0) {
return cb();
}

var killCount = 0;
var kills = {};

Expand Down
9 changes: 9 additions & 0 deletions test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,14 @@ test_regression_kill_sync_async = assert "regression/kill-sync-async" do
killFiber (error "Nope.") f1
pure true

test_regression_kill_empty_supervisor Aff Unit
test_regression_kill_empty_supervisor = assert "regression/kill-empty-supervisor" do
f1 ← forkAff $ supervise $ delay $ Milliseconds 10.0
let
a = parallel $ killFiber (error "Nope.") f1 $> true
b = parallel $ delay (Milliseconds 20.0) $> false
sequential (a <|> b)

main Effect Unit
main = do
test_pure
Expand Down Expand Up @@ -715,3 +723,4 @@ main = do
test_regression_par_apply_async_canceler
test_regression_bracket_catch_cleanup
test_regression_kill_sync_async
test_regression_kill_empty_supervisor

0 comments on commit b5240af

Please sign in to comment.