This CL introduces no behavior change to the takeUntil() operator, it only implements a simplification. Prior to this PR, takeUntil() declared an AbortController which managed an AbortSignal that fed into the sourceObservable and notifier Observable subscriptions. This was so that the two Observables could trigger unsubscriptions to each other, if i.e., sourceObservable completes, or if notifier next()s or errors()s.
But I didn't realize that we don't actually have to do that. As long as those operations either "complete" or "error" the "outer" Subscriber (that is associated with the Observable returned from takeUntil()), then the outer Subscriber's signal will be aborted, and we can simply use that AbortSignal as the input to the subscription of sourceObservable and notifier and have the same effect, without needing to maintain our own AbortController.
I am merging this myself since I implemented this as part of https://crrev.com/c/5311097 and found that there was no observable (pun) behavior change, as expected.
This CL introduces no behavior change to the
takeUntil()
operator, it only implements a simplification. Prior to this PR,takeUntil()
declared an AbortController which managed an AbortSignal that fed into thesourceObservable
andnotifier
Observable subscriptions. This was so that the two Observables could trigger unsubscriptions to each other, if i.e.,sourceObservable
completes, or ifnotifier
next()s or errors()s.But I didn't realize that we don't actually have to do that. As long as those operations either "complete" or "error" the "outer"
Subscriber
(that is associated with the Observable returned fromtakeUntil()
), then the outer Subscriber's signal will be aborted, and we can simply use that AbortSignal as the input to the subscription ofsourceObservable
andnotifier
and have the same effect, without needing to maintain our own AbortController.I am merging this myself since I implemented this as part of https://crrev.com/c/5311097 and found that there was no observable (pun) behavior change, as expected.
Preview | Diff