Skip to content

Commit

Permalink
Deleted unnecessary attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Aug 12, 2020
1 parent 7138a91 commit 675a619
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
13 changes: 4 additions & 9 deletions src/plugins/data/public/search/search_interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ export class SearchInterceptor {
*/
protected abortController = new AbortController();

/**
* The number of pending search requests.
*/
protected pendingCount = 0;

/**
* Observable that emits when the number of pending requests changes.
*/
protected pendingCount$ = new BehaviorSubject(this.pendingCount);
protected pendingCount$ = new BehaviorSubject(0);

/**
* The subscriptions from scheduling the automatic timeout for each request.
Expand Down Expand Up @@ -118,7 +113,7 @@ export class SearchInterceptor {
/**
* Searches using the given `search` method. Overrides the `AbortSignal` with one that will abort
* either when `cancelPending` is called, when the request times out, or when the original
* `AbortSignal` is aborted. Updates the `pendingCount` when the request is started/finalized.
* `AbortSignal` is aborted. Updates `pendingCount$` when the request is started/finalized.
*/
public search(
request: IEsSearchRequest,
Expand All @@ -131,11 +126,11 @@ export class SearchInterceptor {
}

const { combinedSignal, cleanup } = this.setupTimers(options);
this.pendingCount$.next(++this.pendingCount);
this.pendingCount$.next(this.pendingCount$.getValue() + 1);

return this.runSearch(request, combinedSignal, options?.strategy).pipe(
finalize(() => {
this.pendingCount$.next(--this.pendingCount);
this.pendingCount$.next(this.pendingCount$.getValue() - 1);
cleanup();
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class EnhancedSearchInterceptor extends SearchInterceptor {
const { combinedSignal, cleanup } = this.setupTimers(options);
const aborted$ = from(toPromise(combinedSignal));

this.pendingCount$.next(++this.pendingCount);
this.pendingCount$.next(this.pendingCount$.getValue() + 1);

return this.runSearch(request, combinedSignal, options?.strategy).pipe(
expand((response) => {
Expand Down Expand Up @@ -112,7 +112,7 @@ export class EnhancedSearchInterceptor extends SearchInterceptor {
},
}),
finalize(() => {
this.pendingCount$.next(--this.pendingCount);
this.pendingCount$.next(this.pendingCount$.getValue() - 1);
cleanup();
})
);
Expand Down

0 comments on commit 675a619

Please sign in to comment.