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 {
29
29
30
30
reset ( ) : void {
31
31
this . delegageUsageManager . reset ( ) ;
32
+ this . _abortController ?. abort ( ) ;
32
33
this . _abortController = new AbortController ( ) ;
33
34
this . _usageClient = undefined ;
34
35
this . _measurement = undefined ;
@@ -75,12 +76,18 @@ export class ProdUsageManager implements UsageManager {
75
76
76
77
this . _abortController = new AbortController ( ) ;
77
78
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 ;
81
88
}
82
89
83
- await this . #reportUsage ( ) ;
90
+ throw error ;
84
91
}
85
92
}
86
93
You can’t perform that action at this time.
0 commit comments