@@ -123,7 +123,7 @@ export class MetricsListener {
123
123
}
124
124
}
125
125
126
- this . _localFlush ( ) ;
126
+ await this . _localFlush ( ) ;
127
127
this . currentProcessor = undefined ;
128
128
}
129
129
@@ -166,8 +166,8 @@ export class MetricsListener {
166
166
167
167
private async createProcessor ( config : MetricsConfig , apiKey : Promise < string > ) {
168
168
if ( ! this . isExtensionRunning && ! this . config . logForwarding ) {
169
- const APIClient = require ( "./api" ) . APIClient ;
170
- const Processor = require ( "./processor" ) . Processor ;
169
+ const { APIClient } = require ( "./api" ) ;
170
+ const { Processor } = require ( "./processor" ) ;
171
171
172
172
const key = await apiKey ;
173
173
const url = `https://api.${ config . siteURL } ` ;
@@ -196,9 +196,9 @@ export class MetricsListener {
196
196
private async _localFlush ( ) {
197
197
try {
198
198
if ( this . isExtensionRunning && this . config . localTesting ) {
199
- const utils = require ( "../utils/request" ) ;
199
+ const { post } = require ( "../utils/request" )
200
200
const url = new URL ( LOCAL_FLUSH_PATH , EXTENSION_URL ) ;
201
- const result = await utils . post ( url , { } , { timeout : LOCAL_FLUSH_TIMEOUT_MS } ) ;
201
+ const result = await post ( url , { } , { timeout : LOCAL_FLUSH_TIMEOUT_MS } ) ;
202
202
if ( ! result . success ) {
203
203
logError ( `Failed to flush extension. ${ result . errorMessage } ` ) ;
204
204
}
0 commit comments