Skip to content

Commit d8cc180

Browse files
committed
(#5) Removed code smell while working on sonar issues
1 parent a738e19 commit d8cc180

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/util/poll-action.function.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export function timeout<R>(updateIntervalMs: number, maxDurationMs: number, action: (...params: any) => Promise<R>): Promise<R> {
22
return new Promise<R>((resolve, reject) => {
33
let interval: NodeJS.Timeout;
4-
const timeout = setTimeout(
4+
const maxTimeout = setTimeout(
55
() => {
6-
clearTimeout(timeout);
6+
clearTimeout(maxTimeout);
77
if (interval) {
88
clearTimeout(interval);
99
}
@@ -17,7 +17,7 @@ export function timeout<R>(updateIntervalMs: number, maxDurationMs: number, acti
1717
if (!result) {
1818
interval = setTimeout(intervalFunc, updateIntervalMs);
1919
} else {
20-
clearTimeout(timeout);
20+
clearTimeout(maxTimeout);
2121
clearTimeout(interval);
2222
resolve(result);
2323
}
@@ -31,7 +31,7 @@ export function timeout<R>(updateIntervalMs: number, maxDurationMs: number, acti
3131
if (!result) {
3232
startInterval();
3333
} else {
34-
clearTimeout(timeout);
34+
clearTimeout(maxTimeout);
3535
resolve(result);
3636
}
3737
}).catch(() => {

0 commit comments

Comments
 (0)