Sequencial instead of parallel fetching
This commit is contained in:
parent
fd0908a88b
commit
39a0382318
@ -1,6 +1,7 @@
|
|||||||
import { convertEndpointChangeToMeiliDocuments } from "src/convert";
|
import { convertEndpointChangeToMeiliDocuments } from "src/convert";
|
||||||
import { meili, payload } from "src/services";
|
import { meili, payload } from "src/services";
|
||||||
import { MeiliIndexes } from "src/shared/meilisearch/constants";
|
import { MeiliIndexes } from "src/shared/meilisearch/constants";
|
||||||
|
import type { MeiliDocument } from "src/shared/meilisearch/types";
|
||||||
|
|
||||||
export const synchronizeMeiliDocs = async () => {
|
export const synchronizeMeiliDocs = async () => {
|
||||||
const version = await meili.getVersion();
|
const version = await meili.getVersion();
|
||||||
@ -31,9 +32,10 @@ export const synchronizeMeiliDocs = async () => {
|
|||||||
|
|
||||||
const allChanges = (await payload.getAll()).data;
|
const allChanges = (await payload.getAll()).data;
|
||||||
|
|
||||||
const documents = (
|
const documents: MeiliDocument[] = [];
|
||||||
await Promise.all(allChanges.map(convertEndpointChangeToMeiliDocuments))
|
for (const change of allChanges) {
|
||||||
).flat();
|
documents.push(...(await convertEndpointChangeToMeiliDocuments(change)));
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Adding", documents.length, "documents to Meilisearch");
|
console.log("Adding", documents.length, "documents to Meilisearch");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user