• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NikolayMakhonin / time-limits / #7

pending completion
#7

push

NikolayMakhonin
v0.0.7

228 of 309 branches covered (73.79%)

Branch coverage included in aggregate %.

57 of 57 new or added lines in 5 files covered. (100.0%)

492 of 589 relevant lines covered (83.53%)

104193.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

8.33
/src/pool/poolRunThrow.ts
1
import {IPool} from '~/src'
2
import {isPromiseLike} from '@flemist/async-utils'
1✔
3
import {PoolHoldError} from 'src/pool/PoolHoldError'
1✔
4

5
export function poolRunThrow<T>(
1✔
6
  pool: IPool,
×
7
  count: number,
×
8
  func: () => T,
×
9
): T {
10
  const hold = pool.hold(count)
×
11
  if (!hold) {
×
12
    throw new PoolHoldError(count)
×
13
  }
×
14

15
  try {
×
16
    const resultOrPromise = func()
×
17
    if (!isPromiseLike(resultOrPromise)) {
×
18
      return resultOrPromise
×
19
    }
20
    return (async () => {
×
21
      try {
×
22
        const result = await resultOrPromise
×
23
        return result
×
24
      }
×
25
      finally {
26
        void pool.release(count)
×
27
      }
×
28
    })() as any
×
29
  }
30
  finally {
31
    void this._pool.release(count)
×
32
  }
33
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc