Skip to content

Commit

Permalink
fix(server): commit import not finishing correctly (#2153)
Browse files Browse the repository at this point in the history
* fix(server): commit import not finishing correctly

* awaiting last batch added

* minor fix
  • Loading branch information
fabis94 authored Mar 22, 2024
1 parent a489a7b commit 663eaac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function useViewerObjectAutoLoading() {
viewer.loadObjectAsync(
objectUrl,
authToken.value || undefined,
disableViewerCache ? false : undefined, // TODO: Undo
disableViewerCache ? false : undefined,
options?.zoomToObject
)
}
Expand Down
3 changes: 3 additions & 0 deletions packages/server/modules/cross-server-sync/services/commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,9 @@ const loadAllObjectsFromParent = async (
batchPromises = []
}
}

// If any remaining promises - await them
await Promise.all(batchPromises)
}

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/shared/src/core/helpers/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 663eaac

Please sign in to comment.