Skip to content

Change TLDR_CACHE_MAX_AGE default #170

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

Merged
merged 3 commits into from
Nov 12, 2021

Conversation

CleanMachine1
Copy link
Member

@CleanMachine1 CleanMachine1 commented Nov 7, 2021

I feel 24 hours is extreme, and it annoys me when I first started using this client.

On average I probably only use tldr 1-2 times a day, therefore I have to wait each time for it to download a new cache everyday, which normally includes the additions of 0-10 pages/changes.

It goes from nearly instant with using an out of date cache to waiting a few seconds for a command if you use an updated cache which is just slightly annoying.

Simple change, however others may find this controversial 🤷

edit: PS, I forgot to mention that I had already changed the cache date for my .zshrc a weeks back, however the change I made, I felt needed to be standardized

@CleanMachine1
Copy link
Member Author

Do I need to remove the comments?

Copy link

@marchersimon marchersimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the changes, but I think the added comments are not really necessary. Either way, thanks

Copy link
Member

@sbrl sbrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @CleanMachine1!

Looking at the commit history let's wait for @MasterOdin to merge this?

@sbrl
Copy link
Member

sbrl commented Nov 7, 2021

Hrm, some of the builds are failing here?

@marchersimon
Copy link

./tldr.py:33:67: E261 at least two spaces before inline comment
./tldr.py:34:63: E261 at least two spaces before inline comment
./tldr.py:35:63: E261 at least two spaces before inline comment
./tldr.py:35:89: E501 line too long (95 > 88 characters)

Those are all because of the comments. As already said, I don't think they're necessary.

@CleanMachine1
Copy link
Member Author

@MasterOdin Could we get a review?

README.md Outdated
@@ -77,7 +77,7 @@ Cache is downloaded from `TLDR_DOWNLOAD_CACHE_LOCATION` (defaults to the one des
* `TLDR_CACHE_ENABLED` (default is `1`):
* If set to `1`, the client will first try to load from cache, and fall back to fetching from the internet if the cache doesn't exist or is too old.
* If set to `0`, the client will fetch from the internet, and fall back to the cache if the page cannot be fetched from the internet.
* `TLDR_CACHE_MAX_AGE` (default is `24`): maximum age of the cache in hours to be considered as valid when `TLDR_CACHE_ENABLED` is set to `1`.
* `TLDR_CACHE_MAX_AGE` (default is `168`): maximum age of the cache in hours to be considered as valid when `TLDR_CACHE_ENABLED` is set to `1`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we specify what 168 is here?

(default is 168 hours, or one week)

tldr.py Outdated
@@ -32,7 +32,7 @@

USE_NETWORK = int(os.environ.get('TLDR_NETWORK_ENABLED', '1')) > 0
USE_CACHE = int(os.environ.get('TLDR_CACHE_ENABLED', '1')) > 0
MAX_CACHE_AGE = int(os.environ.get('TLDR_CACHE_MAX_AGE', 24))
MAX_CACHE_AGE = int(os.environ.get('TLDR_CACHE_MAX_AGE', 168))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this to be 24 * 7? Makes it a bit easier to quickly parse.

@CleanMachine1
Copy link
Member Author

Can I get some reviews here please

@CleanMachine1 CleanMachine1 merged commit b35b924 into tldr-pages:main Nov 12, 2021
@CleanMachine1 CleanMachine1 deleted the change-cache-age branch November 12, 2021 23:49
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

Successfully merging this pull request may close these issues.

5 participants