Skip to content

Commit

Permalink
return types
Browse files Browse the repository at this point in the history
  • Loading branch information
mapsam committed Oct 2, 2024
1 parent c8d1015 commit 55b2f82
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ import { LRUCache } from 'lru-cache';
import hash from 'object-hash';

type HashKey = string;
interface Stats {
activeLocks: number;
size: number;
locks: number;
miss: number;
hit: number;
refreshHit: number;
calls: number;
}

export class LockingAsync {
/*
Expand Down Expand Up @@ -64,7 +73,7 @@ export class LockingAsync {
});
}

get stats() {
get stats(): Stats {
const activeLocks =
Object.keys(this.#locks).reduce((total, key) => {
return (total += this.#locks[key].length);
Expand All @@ -77,7 +86,7 @@ export class LockingAsync {
};
}

async get(...args: any[]) {
async get(...args: any[]): Promise<any> {
this.#stats.calls++;
return new Promise(async (resolve, reject) => {
let staleRefresh = false;
Expand Down

0 comments on commit 55b2f82

Please sign in to comment.