File tree 1 file changed +7
-7
lines changed
packages/opentelemetry-exporter-collector/src/platform/browser
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -68,19 +68,14 @@ export abstract class CollectorExporterBrowserBase<
68
68
const serviceRequest = this . convert ( items ) ;
69
69
const body = JSON . stringify ( serviceRequest ) ;
70
70
71
- const promise = new Promise ( resolve => {
71
+ const promise = new Promise < void > ( ( resolve ) => {
72
72
const _onSuccess = ( ) : void => {
73
73
onSuccess ( ) ;
74
- _onFinish ( ) ;
74
+ resolve ( ) ;
75
75
} ;
76
76
const _onError = ( error : collectorTypes . CollectorExporterError ) : void => {
77
77
onError ( error ) ;
78
- _onFinish ( ) ;
79
- } ;
80
- const _onFinish = ( ) => {
81
78
resolve ( ) ;
82
- const index = this . _sendingPromises . indexOf ( promise ) ;
83
- this . _sendingPromises . splice ( index , 1 ) ;
84
79
} ;
85
80
86
81
if ( this . _useXHR ) {
@@ -97,5 +92,10 @@ export abstract class CollectorExporterBrowserBase<
97
92
}
98
93
} ) ;
99
94
this . _sendingPromises . push ( promise ) ;
95
+ const _onFinish = ( ) => {
96
+ const index = this . _sendingPromises . indexOf ( promise ) ;
97
+ this . _sendingPromises . splice ( index , 1 ) ;
98
+ } ;
99
+ promise . then ( _onFinish ) ;
100
100
}
101
101
}
You can’t perform that action at this time.
0 commit comments