Skip to content

Commit b5240af

Browse files
authored
Fix supervision when no child filbers are active (#164)
* Fix supervision when no child filbers are active * Fix callback reference
1 parent 202a3ea commit b5240af

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Effect/Aff.js

+4
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ var Aff = function () {
169169
},
170170
killAll: function (killError, cb) {
171171
return function () {
172+
if (count === 0) {
173+
return cb();
174+
}
175+
172176
var killCount = 0;
173177
var kills = {};
174178

test/Test/Main.purs

+9
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,14 @@ test_regression_kill_sync_async = assert "regression/kill-sync-async" do
667667
killFiber (error "Nope.") f1
668668
pure true
669669

670+
test_regression_kill_empty_supervisor Aff Unit
671+
test_regression_kill_empty_supervisor = assert "regression/kill-empty-supervisor" do
672+
f1 ← forkAff $ supervise $ delay $ Milliseconds 10.0
673+
let
674+
a = parallel $ killFiber (error "Nope.") f1 $> true
675+
b = parallel $ delay (Milliseconds 20.0) $> false
676+
sequential (a <|> b)
677+
670678
main Effect Unit
671679
main = do
672680
test_pure
@@ -715,3 +723,4 @@ main = do
715723
test_regression_par_apply_async_canceler
716724
test_regression_bracket_catch_cleanup
717725
test_regression_kill_sync_async
726+
test_regression_kill_empty_supervisor

0 commit comments

Comments
 (0)