Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix delay between each run in waitDelay #111

Merged
merged 1 commit into from
May 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/dap/adi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ export class ADI implements DAP {
* Continually run a function until it returns true
* @param fn The function to run
* @param timeout Optional timeout to wait before giving up and throwing
* @param timer The milliseconds to wait between each run
* @param delay The milliseconds to wait between each run
* @returns Promise
*/
protected async waitDelay(fn: () => Promise<boolean>, timeout: number = 0, timer: number = DEFAULT_WAIT_DELAY): Promise<void> {
protected async waitDelay(fn: () => Promise<boolean>, timeout: number = 0, delay: number = DEFAULT_WAIT_DELAY): Promise<void> {
let running = true;

if (timeout > 0) {
Expand All @@ -92,8 +92,8 @@ export class ADI implements DAP {
return;
}

if (timer > 0) {
await new Promise(resolve => setTimeout(resolve, timeout));
if (delay > 0) {
await new Promise(resolve => setTimeout(resolve, delay));
}
}
}
Expand Down
Loading