-
-
Notifications
You must be signed in to change notification settings - Fork 50
Auto updating local data if too old #97
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
Conversation
Would one of the maintainers care to take a look at this? Pinging @MasterOdin, @owenvoke, whoever else wants do. |
Hi all! This thread has not had any recent activity. |
Hi all! This thread has not had any recent activity. |
Once again pinging @MasterOdin, @owenvoke, @kbdharun or any other maintainer. Any feedback on this? |
Hi, I too think this will be useful, unfortunately, I can't review this extensively as I am not proficient with C even though I know it a bit. I will skim through it, but I would suggest other maintainers reviewing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change makes sense to me, but just some UX (color) concerns!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, also want to nitpick at the copy.
No need for the word automatic here, the user knows it's automatic because it was automatically done for them!
It's also a bit jarring to refer to it as data
in one string, and then database
immediately after. ^-^'
It's referred to as local database
explicitly everywhere else, let's stick with that!
See how the only instances of
local data
(without havingbase
affixed to it) are the instances from this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm so sorry for the review spam, I just keep getting new thoughts when I think I'm finished! I think this will be a no-go as it is now.
There are users who specifically don't want it to automatically try to update the cache, i.e. due to poor network conditions.
Having logic to preserve the original behavior as default, and only perform the update when toggled, i.e. via environment variable or client setting should be a prerequisite.
I think this could be easily/simply implemented by giving users the option to set an environment variable, e.g.
TLDR_AUTOUPDATE
.— #81
Thank you so much for looking at it! I agree with both the color and wording points, those seem reasonable. For your last point: That is a bit of an issue, can't have it both ways. The current archive is ~6MB. My personal preference would be to automatically download the updates and having an option with either an argument and/or an environment variable to disable it. If I am currently in an environment where the network is slow enough for me to care about it, I'd probably like one of the following behaviours:
I only ever invoke Opinions on this? |
Overall, this is actually my preference as well. If this were a new client, I'd expect to see this. However, when a project is already out and being used in the wild, I think it's often best to make changes like these iteratively. So to preserve the original behavior and make the option to opt-in for automatic updates, and at a later time change the default if it's deemed safe to do so. However, I'm happy to concede if other maintainers think it's not a big deal.
This wouldn't be good UX. No one likes inconsistent behavior. An implementation like this leads to unpredictable output since it entirely depends on network conditions. Even on a fast network, sometimes it can be congested.
This is viable. 👍
This wouldn't be a good UX. It'd be like the terminal equivalent of CLS (Cumulative Layout Shift) in browsers. At that point, I think it'd be better to just make users wait for the update. Imo this is more work, for a lesser experience. From my perspective, so long as it's configurable (opt-in or opt-out), I'd be willing to approve the PR. But if the default behavior changes, I'll wait for another maintainer to approve/merge before merging it myself, just to solidify if we're happy to change it. PS: While I had some negative feedback for some of the ideas, I do like and appreciate that you pitched numerous designs for this. 👍 Don't be afraid to tell me if you think I'm wrong about anything! |
Thank you for your feedback! I'm just pitching ideas and as long as we end up agreeing on something, I am happy. So, assuming we implement a
|
Hmm, I don't think a flag would be ideal for this. It's not like users will use Removing the Assuming the default behavior changes to auto-update, users can just set an environment variable like Think of it like This is basically the inverse of the original proposal to have an environment variable to enable auto-updates. If the environment variable is defined, auto-updates are not performed unless the |
That seems like an elegant solution. I implemented it, added a comment to the message explaining that the auto update is about to happen and one to the README for documentation. I also added a check that prevents With those changes this PR would be ready for a new round of reviews in my opinion, so if anyone would like to take a look, please do! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks pretty good to me, thanks for taking the time to make implement this. Once the issues I noted are resolved, I'd be happy to approve this.
We'll need other maintainers to review the UX regarding prints specific for disabled automatic updates, but I'll request more reviews once everything else is fine. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, one petty change and I think this is good.
I hope other maintainers agree. ^-^
Co-authored-by: Seth Falco <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good change. 👍
Thank you for your contribution!
I'm happy to approve, but I would prefer to wait for an OG maintainer to chime and confirm they are happy with the default behavior changing before we merge.
I'll pester people in Matrix if no one wants to come around to review this soon.
Edit: I think this also solves #27, so after this, I'll also close that and post a comment with how to achieve the desired behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks for your contribution.
@SethFalco Any progress on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. I think it may make sense to release this as part of a major release to better signify the change in behavior around when updates get downloaded.
Offtopic: I think we should create one for our Python and Elixr client too, as we updated the tldr source from |
What does it do?
If the local data is too old, it now no longer asks you to manually update it but attempts to automatically do so. Regardless of whether it succeeds, the output is shown.
Why the change?
It is annoying to manually update it. See also #81.
How can this be tested?
Change the date in
~/.tldrc/date
to something further back than the past two weeks, run anytldr
command liketldr tldr
Where to start code review?
Very few lines changed in
local.c
Relevant tickets?
Closes #81.
Questions?
This is just a first attempt. If you'd like me to change how this is implemented, I will gladly do that. I just wanted to start the conversation.