(func: () => Promise<T> | T)
| 3 | private promiseResolverQueue: Array<(v: boolean) => void> = []; |
| 4 | |
| 5 | async inLock<T>(func: () => Promise<T> | T): Promise<T> { |
| 6 | try { |
| 7 | await this.lock(); |
| 8 | return await func(); |
| 9 | } finally { |
| 10 | this.unlock(); |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | private async lock() { |
| 15 | if (this.permits > 0) { |
no test coverage detected