franglais125 / apt-update-indicator

Apt Update Indicator
https://extensions.gnome.org/extension/1139/apt-update-indicator/
GNU General Public License v3.0
44 stars 17 forks source link

Last updates check time should be stored across sessions #3

Closed lucatrv closed 7 years ago

lucatrv commented 7 years ago

Hi, it appears apt-update-indicator is not storing the last updates check time across sessions. I would like to check updates once a day, and there seems to be no way to achieve that. With the default settings (60 min), updates are checked 1 hr after login and then again every 1 hr. If I set a longer time, for instance 720 min, updates are never checked (because I use a session usually for a few hours a day). An improvement would be to store the last updates check time across sessions. Once you log in, the extension would compare the current time with the last stored check time, and run right away if the set time has passed by. The same check (current time vs last stored check time) could be carried out again every minute to decide when to check updates again.

franglais125 commented 7 years ago

Thank you, that is a great idea on how to implement it. I'll definitely look into it!

franglais125 commented 7 years ago

I just updated the master branch to implement your suggestion. Would you mind testing it?

lucatrv commented 7 years ago

Sure I'll do it!

lucatrv commented 7 years ago

It seems to work but with a glitch: the last update time is saved every time the update command is run, even when it was not successful. This can be reproduced for instance clicking on "cancel" when the root password is requested. The last update time should be saved only when the update command completes successfully (exit code "0").

franglais125 commented 7 years ago

Indeed, error handling (i.e. exit status != 0) is not implemented at all. I'll open a new issue for that.

But can you confirm that the extension is correctly checking for updates across sessions, assuming the checks succeed?

lucatrv commented 7 years ago

Yes it works for me now, thanks! Now maybe it would be possible to increase the default interval between update checks from 60 to something like 480 or 600 minutes or more (I set 1200, which is 20 hours). In this case the unit time could also be changed from minutes to hours.

franglais125 commented 7 years ago

As of [788f2d519615729c9fbab623629afb5f2c8e0609], the setting now uses hours instead of minutes. The default value is 12 hours. Thanks!