From 4cf67db6a3fe55948a12271a48873e01f3a047a5 Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Fri, 29 Apr 2022 14:05:12 +0200 Subject: [PATCH] Fix setup index delay issue --- .setup/services/setup.service.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.setup/services/setup.service.ts b/.setup/services/setup.service.ts index 8d5f3ca..de98949 100644 --- a/.setup/services/setup.service.ts +++ b/.setup/services/setup.service.ts @@ -19,7 +19,7 @@ const createProject = async () => { }); }; -const addPlatform = async (hostname : string) => { +const addPlatform = async (hostname: string) => { await api().post("/projects/pingvin-share/platforms", { type: "web", name: "Pingvin Share Web Frontend", @@ -69,7 +69,17 @@ const createCollections = async () => { ); } } + // Wait until the indexes are created for (const index of indexes) { + const getStatus = async () => + ( + await aw().database.getAttribute(collection.$id, index.key) + ).status.toString(); + + while ((await getStatus()) == "processing") { + await new Promise((resolve) => setTimeout(resolve, 1000)); + } + aw().database.createIndex( collection.$id, index.key,