Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 43x 43x 43x 151x 151x 151x 119x 119x 119x 3x 3x 3x 43x 151x 151x 151x 151x 151x 104x 151x 1x | import { BehaviorSubject } from 'rxjs'; import { CLEAN_FN_STATS, ProviderFnStats, ProviderTracker } from './ProviderTracker'; import { StakePoolProvider } from '@cardano-sdk/core'; export class StakePoolProviderStats { readonly healthCheck$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS); readonly queryStakePools$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS); readonly stakePoolStats$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS); shutdown() { this.healthCheck$.complete(); this.queryStakePools$.complete(); this.stakePoolStats$.complete(); } reset() { this.healthCheck$.next(CLEAN_FN_STATS); this.queryStakePools$.next(CLEAN_FN_STATS); this.stakePoolStats$.next(CLEAN_FN_STATS); } } /** Wraps a StakePoolProvider, tracking # of calls of each function */ export class TrackedStakePoolProvider extends ProviderTracker implements StakePoolProvider { readonly stats = new StakePoolProviderStats(); readonly healthCheck: StakePoolProvider['healthCheck']; readonly queryStakePools: StakePoolProvider['queryStakePools']; readonly stakePoolStats: StakePoolProvider['stakePoolStats']; constructor(queryStakePoolsProvider: StakePoolProvider) { super(); queryStakePoolsProvider = queryStakePoolsProvider; this.healthCheck = () => this.trackedCall(() => queryStakePoolsProvider.healthCheck(), this.stats.healthCheck$); this.queryStakePools = (fragments) => this.trackedCall(() => queryStakePoolsProvider.queryStakePools(fragments), this.stats.queryStakePools$); this.stakePoolStats = () => this.trackedCall(() => queryStakePoolsProvider.stakePoolStats(), this.stats.stakePoolStats$); } } |