question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Async index updates (PUT, DELETE)

See original GitHub issue

Hi Fergie, I just discovered this library and think it’s super interesting. Thank you for the work you’ve done in making this a public resource for people to learn from.

I have a question about how the JavaScript event loop is impacted during high-volume updates to the index. Is there any built-in way to run updates to the index asynchronously so that the JavaScript event loop (and the UI of my app/page) isn’t locking up during index updates?

As an analogue, the flexsearch library (which I’m also not familiar with) claims to have an async option you can use when creating an index that will apparently spin up Web Workers to perform updates, so the UI/event loop isn’t locked up during updates.

My app sometimes inserts 10,000 documents into its index at once. It’s an Electron app, so we currently manage the index in a 2nd process to prevent the UI from blocking during large index updates. But we’re considering switching to a Web Workers approach so that we can run a single process and handle index updates within a Web Worker.

Fun with event loop languages!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
aguynamedbencommented, Jul 23, 2020

Cool, thanks for the updates. To be clear, I was asking out of curiosity and to start a discussion to learn. Please don’t think I’m sending you on an errand to implement a feature request. 😃

For context, I’m building an Electron app that can index a large number of documents (100k-1m). We’re using our own logic build on top of LokiJS btrees. We have parts of our indexing/updating happening in the same process that displays the UI, so we have to be careful when doing batch operations. That’s why I was asking about this.

We’ll probably move more of the indexing to a separate process, so that the UI thread isn’t doing any CPU-bound work. This is similar to the concept of using Web Workers. The UI would send [query or batch update] to the [Web Worker or background process] and not be locked up during the response.

Thanks for the feedback, there are tons of interesting links to look through. 🙏 Feel free to close the issue unless you all want to keep the discussion open for a specific reason.

1reaction
fergiemcdowallcommented, Jul 27, 2020

@eklem kudos for getting it to work- thats really interesting!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create, update and delete an index are now asynchronous
Currently, the creation, update, and deletion of an index are synchronous: it is performed immediately after the API call, contrary to all ...
Read more >
Is it possible to do usual atomic INSERT operation but update ...
It's mainly DELETE (and some kinds of UPDATE ) operations on a principal table (PK table) where having indexes on FK columns in...
Read more >
Add, Update or Delete Documents (Azure Cognitive Search ...
Refresh content of an index by replacing, removing, or creating new documents.
Read more >
Index update strategies - Sitecore Documentation
You use index update strategies to maintain indexes. You can configure each index with a unique set of index update strategies.
Read more >
Basic Insert Update and Delete with Dapper | Dave Paquette
All we need to do is call the ExecuteAsync method passing in the SQL statement and the Aircraft entity. // PUT api/aircraft/id [HttpPut("{id}")]...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found