Skip to content

Commit cec8c27

Browse files
committed
chore: simplify a bit
1 parent 659c959 commit cec8c27

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/common/connectionManager.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,24 +287,17 @@ export class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
287287
let ts: NodeJS.Timeout | undefined;
288288

289289
return new Promise<T>((resolve, reject) => {
290-
let count = 1;
291290
ts = setInterval(() => {
292291
if (signal.aborted) {
293292
return reject(new Error(`Aborted: ${signal.reason}`));
294293
}
295294

296295
const status = cm.currentConnectionState;
297296
if (status.tag === tag) {
298-
if (additionalCondition && additionalCondition(status as T)) {
299-
return resolve(status as T);
300-
} else if (!additionalCondition) {
297+
if (!additionalCondition || (additionalCondition && additionalCondition(status as T))) {
301298
return resolve(status as T);
302299
}
303300
}
304-
305-
if (status.tag === "errored") {
306-
console.log("Try", count++, status.tag, status.errorReason);
307-
}
308301
}, 100);
309302
}).finally(() => {
310303
if (ts !== undefined) {

0 commit comments

Comments
 (0)