Skip to content

Client-side savedObject client: optimize bulk get pooling #82581

@pgayvallet

Description

@pgayvallet

The client-side savedObject client is using a pooling mechanism for get operations

public get = <T = unknown>(type: string, id: string): Promise<SimpleSavedObject<T>> => {
if (!type || !id) {
return Promise.reject(new Error('requires type and id'));
}
return new Promise((resolve, reject) => {
this.batchQueue.push({ type, id, resolve, reject } as BatchQueueEntry);
this.processBatchQueue();
});
};

private processBatchQueue = throttle(
() => {
const queue = cloneDeep(this.batchQueue);
this.batchQueue = [];
this.bulkGet(queue)

When calling client.get multiple times with the same type/id tuple, the resulting bulkGet that fires contains these duplicates.

We should remove the dupes when calling the backend, and then optimize the logic to dispatch (copies of) the object to the get calls that requested the same object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:Saved ObjectsTeam:CorePlatform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//enhancementNew value added to drive a business resultperformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions