Required for #53268
In #89562, we migrated almost all plugins to synchronous lifecycle
The server-side part of the fleet plugin was not migrated, because its start method is initializing a service asynchronously
|
public async start(core: CoreStart, plugins: FleetStartDeps): Promise<FleetStartContract> { |
|
await appContextService.start({ |
|
elasticsearch: core.elasticsearch, |
AppContextService.start is only asynchronous because it needs to wait for the initial config emission:
|
if (appContext.config$) { |
|
this.config$ = appContext.config$; |
|
const initialValue = await this.config$.pipe(first()).toPromise(); |
|
this.configSubject$ = new BehaviorSubject(initialValue); |
|
this.config$.subscribe(this.configSubject$); |
|
} |
Now that we introduced a synchronous API to read a plugin's config in #88981, the service could be changed to be synchronous
Note that the only reason I didn't do it in *** is that I wasn't sure if the this.config$.subscribe(this.configSubject$); line was still making any sense now that we have synchronous config access, and wanted to let the owners decide on that one. but AFAIK the changes are trivial.
@elastic/fleet ideally, this would be done for 7.13
cc @elastic/kibana-core
Required for #53268
In #89562, we migrated almost all plugins to synchronous lifecycle
The server-side part of the
fleetplugin was not migrated, because itsstartmethod is initializing a service asynchronouslykibana/x-pack/plugins/fleet/server/plugin.ts
Lines 282 to 284 in 3b3327d
AppContextService.startis only asynchronous because it needs to wait for the initial config emission:kibana/x-pack/plugins/fleet/server/services/app_context.ts
Lines 56 to 61 in 4584a8b
Now that we introduced a synchronous API to read a plugin's config in #88981, the service could be changed to be synchronous
Note that the only reason I didn't do it in *** is that I wasn't sure if the
this.config$.subscribe(this.configSubject$);line was still making any sense now that we have synchronous config access, and wanted to let the owners decide on that one. but AFAIK the changes are trivial.@elastic/fleet ideally, this would be done for
7.13cc @elastic/kibana-core