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

rokucommunity / brighterscript / #13988

10 Mar 2025 03:58PM UTC coverage: 89.113%. Remained the same
#13988

push

TwitchBronBron
0.69.1

7461 of 8823 branches covered (84.56%)

Branch coverage included in aggregate %.

9794 of 10540 relevant lines covered (92.92%)

1836.23 hits per line

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

56.25
/src/KeyedThrottler.ts
1
import { Throttler } from './Throttler';
1✔
2

3
export class KeyedThrottler {
1✔
4
    constructor(
5
        readonly delay: number
1✔
6
    ) {
7

8
    }
9

10
    private throttlers = {} as Record<string, Throttler>;
1✔
11

12
    /**
13
     * Run the job for the specified key
14
     */
15
    public run(key: string, job: any) {
16
        if (!this.throttlers[key]) {
5✔
17
            this.throttlers[key] = new Throttler(this.delay);
1✔
18
        }
19
        return this.throttlers[key].run(job);
5✔
20
    }
21

22
    /**
23
     * Get a promise that resolves the next time the throttler becomes idle.
24
     * If no throttler exists, this will resolve immediately
25
     */
26
    public async onIdleOnce(key: string, resolveImmediatelyIfIdle = true) {
×
27
        const throttler = this.throttlers[key];
×
28
        if (throttler) {
×
29
            return throttler.onIdleOnce(resolveImmediatelyIfIdle);
×
30
        } else {
31
            return Promise.resolve();
×
32
        }
33
    }
34
}
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

© 2025 Coveralls, Inc