-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Running tldr with a non-existent topic or doing an update causes long freezes #441
Comments
Yes, this is due to the single threaded nature of tldr. We try to yield in intervals but it's difficult to make the spinner run more smoothly. But it's just due to the addition of the spinner that you "feel" it's stuck. It's just creating the index. Is there a real bug that you wanted to report? |
So you're saying it's not a bug that if I make a typo or type in a non-existent document I have to open a new terminal shell and or wait two minutes for the program to re-index everything? This isn't just a "feeling" I have. 2 minutes is a long time for the command line to lockup and do nothing. |
Sorry I realize that my earlier post came across as snarky. Wasn't my intention.
You could just cancel the re-indexing. You don't need to wait. The fact that we decide to re-populate the cache if a command isn't found was a design decision based on the fact that the newly entered command might exist in the remote repo, but not in the local cache. We could, technically add an escape hatch to prevent this behavior. I am open to it. But the core issue here is that indexing takes some time and freezes the UI. And that's not a bug. It's just due to the single threaded design of node.js. I am sure it can be improved. PRs would be most welcome. |
What about re-indexing only if page exists in the remote repo (ping https://raw.githubusercontent.com/tldr-pages/tldr/main/pages.xx/platform/page.md)? |
Sure, a reasonable approach. |
We have been providing a pre-built index for a while upstream at https://github.com/tldr-pages/tldr/releases/latest/download/index.json, would it be possible for the Node client to be adapted to use it? |
The client builds its own search index. There's some logic here: https://github.com/tldr-pages/tldr-node-client/blob/main/lib/search.js. Unless we pre-build this entire logic, it might be difficult. |
I'm on alpine, installed with npm. If I do
tldr blah
I see something like this:It just hangs for like two minutes. Same thing happens when
tldr --update
is run.The text was updated successfully, but these errors were encountered: