-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
.export(..) returns bool sync but internally runs async... #353
Comments
thexeos
added a commit
to thexeos/flexsearch
that referenced
this issue
Feb 8, 2023
Create new variable in document and index exports, which contains a handle for Promise resolve call. When Index is exported directly, then `field` argument is `undefined`, thus the Promise is resolved inside the index export method. When Document is exported, then `field` argument is set, thus preventing Promise to be resolved inside Index export method before all indexes, store, and tags are exported.
The below PR allows for |
This was referenced Feb 8, 2023
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
It seems that
.export(..)
, at least on theIndex
, returns true right away but internally runs asynchronously, this is a big issue if one is trying to partition or join the exported data in a custom way, for example it is not possible to collect all the exported data into one object and do something with it...A basic example:
This prints out:
It would be nice/logical to be able to
await
for the export to be done, i.e. for.export(..)
to return a promise.Would also be nice if this promise would account for the handler returning a promise, i.e. resolve when all the returned values are resolved (i.e. via
Promise.all(..)
)Thanks!
The text was updated successfully, but these errors were encountered: