File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
extensions/googlechat/src Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -563,14 +563,20 @@ export const googlechatPlugin: ChannelPlugin<ResolvedGoogleChatAccount> = {
563563 webhookUrl : account . config . webhookUrl ,
564564 statusSink : ( patch ) => ctx . setStatus ( { accountId : account . accountId , ...patch } ) ,
565565 } ) ;
566- return ( ) => {
567- unregister ?.( ) ;
568- ctx . setStatus ( {
569- accountId : account . accountId ,
570- running : false ,
571- lastStopAt : Date . now ( ) ,
572- } ) ;
573- } ;
566+ // Keep the promise pending until abort (webhook mode is passive).
567+ await new Promise < void > ( ( resolve ) => {
568+ if ( ctx . abortSignal . aborted ) {
569+ resolve ( ) ;
570+ return ;
571+ }
572+ ctx . abortSignal . addEventListener ( "abort" , ( ) => resolve ( ) , { once : true } ) ;
573+ } ) ;
574+ unregister ?.( ) ;
575+ ctx . setStatus ( {
576+ accountId : account . accountId ,
577+ running : false ,
578+ lastStopAt : Date . now ( ) ,
579+ } ) ;
574580 } ,
575581 } ,
576582} ;
You can’t perform that action at this time.
0 commit comments