Skip to content

Commit 12441f5

Browse files
committed
Switching license polling from a switchMap to an exhaustMap
When it's ES is slow to respond with a license, or Kibana is overloaded and is slow making the request or handling the response, we were trying to fetch the license again. This will just skip that refresh interval, and catch it the next time around.
1 parent 8276afd commit 12441f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

x-pack/plugins/licensing/common/license_update.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
import { ConnectableObservable, Observable, Subject, from, merge } from 'rxjs';
77

8-
import { filter, map, pairwise, switchMap, publishReplay, takeUntil } from 'rxjs/operators';
8+
import { filter, map, pairwise, exhaustMap, publishReplay, takeUntil } from 'rxjs/operators';
99
import { hasLicenseInfoChanged } from './has_license_info_changed';
1010
import { ILicense } from './types';
1111

@@ -15,7 +15,7 @@ export function createLicenseUpdate(
1515
fetcher: () => Promise<ILicense>,
1616
initialValues?: ILicense
1717
) {
18-
const triggerRefresh$ = trigger$.pipe(switchMap(fetcher));
18+
const triggerRefresh$ = trigger$.pipe(exhaustMap(fetcher));
1919
const manuallyFetched$ = new Subject<ILicense>();
2020

2121
const fetched$ = merge(triggerRefresh$, manuallyFetched$).pipe(

0 commit comments

Comments
 (0)