File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -570,8 +570,6 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
570570 return ;
571571 }
572572
573- let trackedPromise : Promise < unknown > ;
574- const isCurrentTask = ( ) => store . tasks . get ( id ) === trackedPromise ;
575573 scopedChannelRuntime = await measureStartup ( `channels.${ channelId } .runtime` , async ( ) =>
576574 createTaskScopedChannelRuntime ( {
577575 channelRuntime : await getChannelRuntime ( ) ,
@@ -648,7 +646,7 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
648646 } ) ;
649647 // Recovery can replace a timed-out task before the old promise settles.
650648 // Only the task that still owns the store slot may write lifecycle state.
651- trackedPromise = task
649+ const trackedPromise = task
652650 . then ( ( ) => {
653651 if ( abort . signal . aborted || manuallyStopped . has ( rKey ) || ! isCurrentTask ( ) ) {
654652 return ;
@@ -768,6 +766,9 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
768766 store . aborts . delete ( id ) ;
769767 }
770768 } ) ;
769+ function isCurrentTask ( ) {
770+ return store . tasks . get ( id ) === trackedPromise ;
771+ }
771772 handedOffTask = true ;
772773 store . tasks . set ( id , trackedPromise ) ;
773774 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments