fix(server): commit import not finishing correctly (#2153)

* fix(server): commit import not finishing correctly

* awaiting last batch added

* minor fix
This commit is contained in:
Kristaps Fabians Geikins
2024-03-22 10:27:34 +01:00
committed by GitHub
parent a489a7bb9a
commit 663eaac5a2
3 changed files with 6 additions and 2 deletions
@@ -102,7 +102,7 @@ function useViewerObjectAutoLoading() {
viewer.loadObjectAsync(
objectUrl,
authToken.value || undefined,
disableViewerCache ? false : undefined, // TODO: Undo
disableViewerCache ? false : undefined,
options?.zoomToObject
)
}
@@ -564,6 +564,9 @@ const loadAllObjectsFromParent = async (
batchPromises = []
}
}
// If any remaining promises - await them
await Promise.all(batchPromises)
}
/**
+2 -1
View File
@@ -32,7 +32,8 @@ export const retry = async <V = unknown>(fn: () => MaybeAsync<V>, n: number) =>
let lastError: Error | undefined
for (let i = 0; i < n; i++) {
try {
return await Promise.resolve(fn())
const res = await Promise.resolve(fn())
return res
} catch (error) {
lastError = ensureError(error)
}