Skip to content

Commit 64d7a3b

Browse files
committed
update imports and add await
1 parent 1903994 commit 64d7a3b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/metrics/listener.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class MetricsListener {
123123
}
124124
}
125125

126-
this._localFlush();
126+
await this._localFlush();
127127
this.currentProcessor = undefined;
128128
}
129129

@@ -166,8 +166,8 @@ export class MetricsListener {
166166

167167
private async createProcessor(config: MetricsConfig, apiKey: Promise<string>) {
168168
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");
171171

172172
const key = await apiKey;
173173
const url = `https://api.${config.siteURL}`;
@@ -196,9 +196,9 @@ export class MetricsListener {
196196
private async _localFlush() {
197197
try {
198198
if (this.isExtensionRunning && this.config.localTesting) {
199-
const utils = require("../utils/request");
199+
const { post } = require("../utils/request")
200200
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 });
202202
if (!result.success) {
203203
logError(`Failed to flush extension. ${result.errorMessage}`);
204204
}

0 commit comments

Comments
 (0)