Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/batch backfill v18 #70

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

DavidWeiss2
Copy link

Change Summary

The current batch mechanism is failing on Firestore big collections with a function crash.
This PR fixing this issue.

Also on this PR -
Better comments for failing batch (the current one get trimmed when multiple errors)

but for v18

PR Checklist

@DavidWeiss2
Copy link
Author

Saw the conflicts, fixing them.

@jasonbosco jasonbosco mentioned this pull request Dec 23, 2023
1 task
@DavidWeiss2
Copy link
Author

@jasonbosco Conflict resolved

Copy link
Member

@jasonbosco jasonbosco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like tests are failing

- Modify `typesenseDocumentFromSnapshot` calls to use `Promise.all`,
ensuring proper handling of asynchronous operations during the
backfill process from Firestore to Typesense.
@tharropoulos
Copy link
Collaborator

tharropoulos commented Sep 13, 2024

Looks like tests are failing

In 30105bc , there was a change introduced on line 53, regarding the currentDocumentsBatch variable

const currentDocumentsBatch = thisBatch.docs.map((doc) => utils.typesenseDocumentFromSnapshot(doc));

This implementation resulted in currentDocumentsBatch being an array of pending promises, as typesenseDocumentFromSnapshot is an asynchronous function (Although only because of the dynamic import of flat).

So, in b8d9207, changing this line to

const currentDocumentsBatch = await Promise.all(thisBatch.docs.map(async (doc) => {
  return await utils.typesenseDocumentFromSnapshot(doc);
}));

takes care of the issue, resolving to the corresponding document schema that the import endpoint expects.

@tharropoulos tharropoulos changed the base branch from node-18-upgrade to master September 16, 2024 13:01
@tharropoulos tharropoulos changed the base branch from master to node-18-upgrade September 16, 2024 13:01
@tharropoulos tharropoulos changed the base branch from node-18-upgrade to master September 16, 2024 13:12
@tharropoulos
Copy link
Collaborator

Rebased master into the branch, can now target master.

@DavidWeiss2
Copy link
Author

What needed to fix in this PR in order to merge it?

@tharropoulos
Copy link
Collaborator

What needed to fix in this PR in order to merge it?

Tests were failing, I've posted a comment above referencing what went wrong (returning a promise instead of unpacking it)

@DavidWeiss2
Copy link
Author

What needed to fix in this PR in order to merge it?

Tests were failing, I've posted a comment above referencing what went wrong (returning a promise instead of unpacking it)

So now this is just waiting for Jason approval?

- Add more spaces
- Add JSdoc for error logging function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants