-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Make arch_updates module more responsive to system updates #2215
Conversation
4a53386
to
1cb8eb2
Compare
1cb8eb2
to
4b0627a
Compare
I trust you as a module user and the logic LGTM thanks! |
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.
Sorry for not reviewing this sooner.
refresh_interval: interval (in seconds) between refreshing data from package | ||
database or AUR. Note that this module may refresh sooner than the | ||
specified interval, if pacman log is modified since the last refresh | ||
time. (default 3600) |
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.
This shouldn't be renamed just because it gets refreshed sooner. Modules get refreshed sooner all times via clicks, py3-cmd, i3, et cetera. This now ignore people's current cache_timeout
setting too.
format = None | ||
hide_if_zero = False | ||
pacman_log_location = "/var/log/pacman.log" |
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.
(Opinion) I'd like the module to just parse /etc/pacman.conf and grab the log location from there instead.
self.py3.storage_set(CACHE_KEY_TEXT, full_text) | ||
self.py3.storage_set(CACHE_KEY_TIMESTAMP, time.time()) | ||
|
||
return {"full_text": full_text} |
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 not using Arch right now, but this looks like arch_updates
module may be constantly updated all times now... in order to avoid running updater command. Unconfirmed, but something to think about.
The better way just may be to document users to use this hook instead with py3-cmd refresh arch_updates
along with either disabled cache_timeout = -1
or longer delay cache_timeout = 3600
. https://archlinux.org/pacman/alpm-hooks.5.html
ultrabug#2215)" This reverts commit 24888b3.
ultrabug#2215)" This reverts commit 24888b3.
ultrabug#2215)" This reverts commit 24888b3.
The goal of this PR is that we want to invalidate the cached output of the
arch_updates
module after a system update. The gist of the approach is this:cached_until
andcache_timeout
values, thus bypassing built-in caching of py3statusThis whole business of bypassing the built-in caching feels a bit dirty, but I'm not familiar with py3status's full module API to know if there's a better approach? @ultrabug What do you think?
Also, now that the module can be more responsive, we can change the default of refresh interval to be longer without degrading user experience