File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -561,14 +561,11 @@ where
561
561
}
562
562
563
563
// Only clone if we have receivers
564
+ // This is not a race condition because after inner gets assigned above (or if the request has been aborted),
565
+ // this Arc will be inaccessible from the struct and no new receivers can subscribe
564
566
if arc. 1 . receiver_count ( ) > 0 {
565
- // We have receivers, so we can unwrap safely
566
- // unwrap_or_else because unwrap and expect need Debug
567
- // There is no race condition here because after line 560, this Arc will be inaccessible
568
- // from the struct and no new receivers can subscribe
569
- arc. 1
570
- . send ( res. clone ( ) )
571
- . unwrap_or_else ( |_| unreachable ! ( "No receivers after receiver count was checked" ) ) ;
567
+ // That being said, others might still *un*subscribe after the if, so we cannot unwrap here
568
+ arc. 1 . send ( res. clone ( ) ) . ok ( ) ;
572
569
}
573
570
574
571
Some ( res)
You can’t perform that action at this time.
0 commit comments