LokiDB icon indicating copy to clipboard operation
LokiDB copied to clipboard

Async operations?

Open gotenxds opened this issue 5 years ago • 1 comments

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?

gotenxds avatar Oct 06 '20 05:10 gotenxds

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

Viatorus avatar Oct 06 '20 06:10 Viatorus