Skip to content

Commit

Permalink
Flaky #190724 (#191010)
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo authored Aug 23, 2024
1 parent 476018a commit 13bd193
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/apps/core-apps-server-internal/src/core_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<Record<string, unknown>>(
DYNAMIC_CONFIG_OVERRIDES_SO_TYPE,
Expand Down Expand Up @@ -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 });
Expand Down

0 comments on commit 13bd193

Please sign in to comment.