File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
packages/core/src/v3/usage Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export class ProdUsageManager implements UsageManager {
2929
3030 reset ( ) : void {
3131 this . delegageUsageManager . reset ( ) ;
32+ this . _abortController ?. abort ( ) ;
3233 this . _abortController = new AbortController ( ) ;
3334 this . _usageClient = undefined ;
3435 this . _measurement = undefined ;
@@ -75,12 +76,18 @@ export class ProdUsageManager implements UsageManager {
7576
7677 this . _abortController = new AbortController ( ) ;
7778
78- for await ( const _ of setInterval ( this . options . heartbeatIntervalMs ) ) {
79- if ( this . _abortController . signal . aborted ) {
80- break ;
79+ try {
80+ for await ( const _ of setInterval ( this . options . heartbeatIntervalMs , undefined , {
81+ signal : this . _abortController . signal ,
82+ } ) ) {
83+ await this . #reportUsage( ) ;
84+ }
85+ } catch ( error ) {
86+ if ( error instanceof Error && error . name === "AbortError" ) {
87+ return ;
8188 }
8289
83- await this . #reportUsage ( ) ;
90+ throw error ;
8491 }
8592 }
8693
You can’t perform that action at this time.
0 commit comments