From 1cf2ad6e3a693d037bc32ff354e50a657260c55d Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Tue, 7 Jul 2020 10:20:12 -0400 Subject: [PATCH] Fix typos after review --- .../services/agents/checkin/rxjs_utils.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/x-pack/plugins/ingest_manager/server/services/agents/checkin/rxjs_utils.ts b/x-pack/plugins/ingest_manager/server/services/agents/checkin/rxjs_utils.ts index bf8fc5f90706..a806169019a1 100644 --- a/x-pack/plugins/ingest_manager/server/services/agents/checkin/rxjs_utils.ts +++ b/x-pack/plugins/ingest_manager/server/services/agents/checkin/rxjs_utils.ts @@ -3,13 +3,13 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { Observable } from 'rxjs'; + import * as Rx from 'rxjs'; export class AbortError extends Error {} export const toPromiseAbortable = ( - observable: Observable, + observable: Rx.Observable, signal?: AbortSignal ): Promise => new Promise((resolve, reject) => { @@ -53,18 +53,18 @@ export function createLimiter(ratelimitIntervalMs: number, ratelimitRequestPerIn let currentInterval: { startedAt: number; numRequests: number } = createCurrentInterval(); let observers: Array<[Rx.Subscriber, any]> = []; - let timerSubsription: Rx.Subscription | undefined; + let timerSubscription: Rx.Subscription | undefined; - function createTimout() { - if (timerSubsription) { + function createTimeout() { + if (timerSubscription) { return; } - timerSubsription = Rx.asyncScheduler.schedule(() => { - timerSubsription = undefined; + timerSubscription = Rx.asyncScheduler.schedule(() => { + timerSubscription = undefined; currentInterval = createCurrentInterval(); for (const [waitingObserver, value] of observers) { if (currentInterval.numRequests >= ratelimitRequestPerInterval) { - createTimout(); + createTimeout(); continue; } currentInterval.numRequests++; @@ -75,7 +75,7 @@ export function createLimiter(ratelimitIntervalMs: number, ratelimitRequestPerIn return function limit(): Rx.MonoTypeOperatorFunction { return (observable) => - new Observable((observer) => { + new Rx.Observable((observer) => { const subscription = observable.subscribe({ next(value) { if (currentInterval.numRequests < ratelimitRequestPerInterval) { @@ -85,7 +85,7 @@ export function createLimiter(ratelimitIntervalMs: number, ratelimitRequestPerIn } observers = [...observers, [observer, value]]; - createTimout(); + createTimeout(); }, error(err) { observer.error(err);