Skip to content

Commit

Permalink
fix: fix fn has been called twice
Browse files Browse the repository at this point in the history
  • Loading branch information
KieraDOG committed Aug 12, 2024
1 parent 3169187 commit 43d8af6
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/CGDGarageDoor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class CGDGarageDoor {
softValue?: string;
until?: () => Promise<boolean>;
}): Promise<unknown> => {
const fn = async () => {
const fn = () => {
this.log.debug(`Setting ${cmd} to ${softValue}`);
let oldStatus: Status;

Expand Down Expand Up @@ -152,18 +152,13 @@ export class CGDGarageDoor {
}
},
});

return result;
};

let result: unknown;
if (until) {
result = await this.withRunQ(cmd, fn);
return this.withRunQ(cmd, fn);
}

result = await fn();

return result;
return fn();
};

private withIsUpdating = async <T>(fn: () => Promise<T>): Promise<void> => {
Expand Down

0 comments on commit 43d8af6

Please sign in to comment.