Skip to content

Commit

Permalink
AbortError / TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
ircfspace committed Mar 5, 2024
1 parent 6e8a48e commit 6579dce
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/hooks/useIPScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ export const useIPScanner = ({ allIps }: IPScannerProps) => {
let testCount = 0;

const startTime = performance.now();
const multiply =
state.maxLatency <= 500 ? 1.5 : state.maxLatency <= 1000 ? 1.2 : 1;
const multiply = state.maxLatency <= 500 ? 1.5 : state.maxLatency <= 1000 ? 1.2 : 1;
let timeout = 1.5 * multiply * state.maxLatency;
for (let i = 0; i < MAX_TRIES; i++) {
const controller = new AbortController();
Expand Down Expand Up @@ -201,9 +200,7 @@ export const useIPScanner = ({ allIps }: IPScannerProps) => {

testCount++;
} catch (error) {
if ( error instanceof Error && error.name === "AbortError") {
//
} else {
if (error instanceof Error && !["AbortError", "TypeError"].includes(error.name)) {
testCount++;
}
}
Expand Down

0 comments on commit 6579dce

Please sign in to comment.