@@ -607,9 +607,10 @@ defmodule Nx.ServingTest do
607
607
# One task should succeed and the other terminate
608
608
assert_receive { :DOWN , ref , _ , _ ,
609
609
{ { % RuntimeError { } , _ } , { Nx.Serving , :local_batched_run , [ _ , _ ] } } }
610
- when ref in [ ref1 , ref2 ]
611
610
612
- assert_receive { :DOWN , ref , _ , _ , :normal } when ref in [ ref1 , ref2 ]
611
+ assert [ other_ref ] = [ ref1 , ref2 ] -- [ ref ]
612
+
613
+ assert_receive { :DOWN , ^ other_ref , _ , _ , :normal }
613
614
refute_received { :execute , _partition , _executor }
614
615
end
615
616
@@ -631,14 +632,14 @@ defmodule Nx.ServingTest do
631
632
632
633
assert_receive { :execute , 0 , executor }
633
634
send ( serving_pid , { :system , { self ( ) , make_ref ( ) } , { :terminate , :shutdown } } )
634
- send ( executor , :continue )
635
-
636
- # One task should succeed and the other terminate
637
- assert_receive { :DOWN , ref , _ , _ , :normal }
638
- when ref in [ ref1 , ref2 ]
639
635
636
+ # The queued caller should be terminated with :noproc right away
640
637
assert_receive { :DOWN , ref , _ , _ , { :noproc , { Nx.Serving , :local_batched_run , [ _ , _ ] } } }
641
- when ref in [ ref1 , ref2 ]
638
+ assert [ other_ref ] = [ ref1 , ref2 ] -- [ ref ]
639
+
640
+ # The executing caller should be able to finish
641
+ send ( executor , :continue )
642
+ assert_receive { :DOWN , ^ other_ref , _ , _ , :normal }
642
643
643
644
refute_received { :execute , _partition , _executor }
644
645
end
@@ -661,14 +662,14 @@ defmodule Nx.ServingTest do
661
662
662
663
assert_receive { :execute , 0 , executor }
663
664
send ( serving_pid , { :system , { self ( ) , make_ref ( ) } , { :terminate , :shutdown } } )
664
- send ( executor , :continue )
665
-
666
- # One task should succeed and the other terminate
667
- assert_receive { :DOWN , ref , _ , _ , :normal }
668
- when ref in [ ref1 , ref2 ]
669
665
666
+ # The stacked caller should be terminated with :noproc right away
670
667
assert_receive { :DOWN , ref , _ , _ , { :noproc , { Nx.Serving , :local_batched_run , [ _ , _ ] } } }
671
- when ref in [ ref1 , ref2 ]
668
+ assert [ other_ref ] = [ ref1 , ref2 ] -- [ ref ]
669
+
670
+ # The executing caller should be able to finish
671
+ send ( executor , :continue )
672
+ assert_receive { :DOWN , ^ other_ref , _ , _ , :normal }
672
673
673
674
refute_received { :execute , _partition , _executor }
674
675
end
0 commit comments