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

Async operations? #186

Open
gotenxds opened this issue Oct 6, 2020 · 1 comment
Open

Async operations? #186

gotenxds opened this issue Oct 6, 2020 · 1 comment

Comments

@gotenxds
Copy link

gotenxds commented Oct 6, 2020

I'm submitting a...

[X] Feature request
[X ] Documentation issue or request

As far as I can see from the code, LokiDb only works in sync methods, in my current work I can see some io blocking (2sec ~) while inserting just 250 entries, this is a bit troubling, as these are not a lot of records and in the future, I will need to insert around 2000.

Is there something I'm missing here? is there a way of making async operations?

@Viatorus
Copy link
Member

Viatorus commented Oct 6, 2020

Async methods like load/save database are promised. All other methods are sync.

If you need async, you have to make your call to insert async.

  • Process one document per async operation instead of all documents at once
  • Use a service worker

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

No branches or pull requests

2 participants