1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-10-01 00:50:10 +02:00

Fix setup index delay issue

This commit is contained in:
Elias Schneider 2022-04-29 14:05:12 +02:00
parent ab88055ffe
commit 4cf67db6a3
No known key found for this signature in database
GPG Key ID: D5EC1C72D93244FD

View File

@ -19,7 +19,7 @@ const createProject = async () => {
}); });
}; };
const addPlatform = async (hostname : string) => { const addPlatform = async (hostname: string) => {
await api().post("/projects/pingvin-share/platforms", { await api().post("/projects/pingvin-share/platforms", {
type: "web", type: "web",
name: "Pingvin Share Web Frontend", name: "Pingvin Share Web Frontend",
@ -69,7 +69,17 @@ const createCollections = async () => {
); );
} }
} }
// Wait until the indexes are created
for (const index of indexes) { 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( aw().database.createIndex(
collection.$id, collection.$id,
index.key, index.key,