Skip to content

Commit

Permalink
Fix finally usage (#29)
Browse files Browse the repository at this point in the history
* fix finally usage

Signed-off-by: James Elias Sigurdarson <[email protected]>

* also wrap in block

Signed-off-by: James Elias Sigurdarson <[email protected]>

* fix test

Signed-off-by: James Elias Sigurdarson <[email protected]>

* forgot to save

Signed-off-by: James Elias Sigurdarson <[email protected]>
  • Loading branch information
jamiees2 authored Feb 11, 2022
1 parent 85f5a4f commit 3410898
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,9 @@ export class FluentClient {
}
if (!this.emitQueue.has(emitPromise)) {
this.emitQueue.add(emitPromise);
emitPromise.finally(() => this.emitQueue.delete(emitPromise));
emitPromise
.finally(() => this.emitQueue.delete(emitPromise))
.catch(() => {});
}
return emitPromise;
}
Expand Down
6 changes: 5 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export const awaitAtMost = <T>(
}, timeout))
),
]);
racePromise.finally(() => (timeoutId ? clearTimeout(timeoutId) : undefined));
racePromise
.finally(() => {
if (timeoutId) clearTimeout(timeoutId);
})
.catch(() => {});
return racePromise;
};

Expand Down

0 comments on commit 3410898

Please sign in to comment.