File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,9 +236,11 @@ export function startNotificationFetch() {
236236 let fetchComplete = false ;
237237
238238 const start = Date . now ( ) ;
239+ const controller = new AbortController ( ) ;
239240
240241 fetch ( CLI_CONFIG_ENDPOINT , {
241242 headers : { accept : 'application/json' } ,
243+ signal : controller . signal ,
242244 } )
243245 . then ( async ( res ) => {
244246 if ( ! res . ok ) return ;
@@ -263,7 +265,13 @@ export function startNotificationFetch() {
263265 await new Promise ( ( resolve ) => setTimeout ( resolve , FETCH_CLI_MAX_TIME - elapsed ) ) ;
264266 }
265267
266- if ( ! fetchComplete || ! fetchedData ) return ;
268+ if ( ! fetchComplete ) {
269+ controller . abort ( ) ;
270+ return ;
271+ }
272+
273+ if ( ! fetchedData ) return ;
274+
267275 const activeItems = fetchedData . notifications . filter ( ( item ) => item . active ) ;
268276 // show a random active item
269277 if ( activeItems . length > 0 ) {
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ export async function run(options: Options) {
3838 console . warn ( colors . yellow ( `Failed to check for mismatched ZenStack packages: ${ err } ` ) ) ;
3939 }
4040
41- const maybeShowNotification = ! options . offline && ! options . silent ? startNotificationFetch ( ) : undefined ;
41+ const maybeShowNotification =
42+ ! options . offline && ! options . silent && ! options . watch ? startNotificationFetch ( ) : undefined ;
4243
4344 const model = await pureGenerate ( options , false ) ;
4445
You can’t perform that action at this time.
0 commit comments