From 13bd1930699499f5fa2632b149c105934c4e16e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Fri, 23 Aug 2024 13:59:34 +0200 Subject: [PATCH] Flaky #190724 (#191010) --- .../core/apps/core-apps-server-internal/src/core_app.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/apps/core-apps-server-internal/src/core_app.ts b/packages/core/apps/core-apps-server-internal/src/core_app.ts index e9676c792292a..5ee8fe4938a44 100644 --- a/packages/core/apps/core-apps-server-internal/src/core_app.ts +++ b/packages/core/apps/core-apps-server-internal/src/core_app.ts @@ -29,13 +29,13 @@ import type { import type { InternalStaticAssets } from '@kbn/core-http-server-internal'; import { combineLatest, - concatMap, firstValueFrom, map, type Observable, ReplaySubject, shareReplay, Subject, + switchMap, takeUntil, timer, } from 'rxjs'; @@ -238,7 +238,7 @@ export class CoreAppsService { // Poll for updates combineLatest([savedObjectsClient$, timer(0, 10_000)]) .pipe( - concatMap(async ([soClient]) => { + switchMap(async ([soClient]) => { try { const persistedOverrides = await soClient.get>( DYNAMIC_CONFIG_OVERRIDES_SO_TYPE, @@ -300,7 +300,10 @@ export class CoreAppsService { await soClient.create(DYNAMIC_CONFIG_OVERRIDES_SO_TYPE, newGlobalOverrides, { id: DYNAMIC_CONFIG_OVERRIDES_SO_ID, overwrite: true, + refresh: false, }); + // set it again in memory in case the timer polling the SO for updates has overridden it during this update. + this.configService.setDynamicConfigOverrides(req.body); } catch (err) { if (err instanceof ValidationError) { return res.badRequest({ body: err });