pl-fe: batch relationships requests

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2025-10-23 19:47:13 +02:00
parent 2effae78de
commit 72d86fd62d
8 changed files with 41 additions and 128 deletions

View File

@@ -0,0 +1,16 @@
import { bufferScheduler, create, keyResolver } from '@yornaath/batshit';
import memoize from 'lodash/memoize';
import type { PlApiClient } from 'pl-api';
const relationships = memoize((client: PlApiClient) => create({
fetcher: (ids: string[]) => client.accounts.getRelationships(ids),
resolver: keyResolver('id'),
scheduler: bufferScheduler(200),
}));
const batcher = {
relationships,
};
export { batcher };