chocolatey / ChocolateyGUI

A delicious GUI for Chocolatey

Home Page:https://docs.chocolatey.org/en-us/chocolatey-gui/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cached file listing outdated packages is not updated when there are no changes

gep13 opened this issue ยท comments

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.

What You Are Seeing?

When configured to do so, Chocolatey GUI figures out all of the outdated packages that are currently installed on the system and writes this information to a file in the users AppData\Local\Chocolatey GUI folder. This file is called outdatedPackages.xml. The idea is that this cached information will be used to display the outdated packages within the UI, without having to always fetch this information. There is also a setting within the Chocolatey GUI called oudatedPackagesCacheDurationsInMinutes which defaults to 60. This setting is used to tell Chocolatey GUI how long it should wait before invalidating the cached file.

Currently, when the 60 minutes expires, Chocolatey GUI correctly fetches the outdated information and attempts to update the cached file, but when there are no changes to the information (i.e. the hash of the file is exactly the same) the file never gets updated, and continues to have the original modified time.

As a result, when the outdated packages is never changing, Chocolatey GUI will continue to unnecessarily fetch outdated information every time, even though the information was fetched, the file was never updated.

This is due to the usage of the XmlService in the Chocolatey.Lib, where it only serializes a file to disk, when it is known that that file has changed. In some cases, this is exactly what you want, but the use case in Chocolatey GUI relies on the timestamp applied to the file when it modified to know that an action is required.

What is Expected?

When information about outdated packages is fetched, the cached file should always be written, regardless of whether the information is the same or not. This will ensure correct usage of the cached file, and prevent unnecessary fetching of information.

How Did You Get This To Happen?

  1. Install Chocolatey GUI
  2. Set oudatedPackagesCacheDurationsInMinutes to a lower value so that is isn't necessary to wait 60 minutes to see this happen
  3. Install an earlier version of a package, for example vlc choco install vlc --version 3.0.16
  4. Open Chocolatey GUI and verify that the package is correctly marked as outdated
  5. Open the users AppData\Local\Chocolatey GUI folder and inspect the modified date of the outdatedPackages.xml file
  6. Close Chocolatey GUI
  7. Wait the length of time in the setting above
  8. Open Chocolatey GUI and verify that outdated packages information is fetched (this can be seen by the progress bar at the bottom of the screen)
  9. Check the outdatedPackages.xml modified date, and verify that it hasn't changed

System Details

  • Operating System: 10.0.17763.0
  • Windows PowerShell version: 5.1.17763.3770
  • Chocolatey CLI Version: 1.2.1
  • Chocolatey Licensed Extension version: 5.0.1
  • Chocolatey License type: Business
  • Terminal/Emulator: WIndows PowerShell

Installed Packages

The currently installed packages has no bearing on this bug.

Output Log

N/A

Additional Context

This was found during investigations into what was required to bring Chocolatey GUI Licensed Extension up to date with the latest alpha version of Chocolatey.Lib.

๐ŸŽ‰ This issue has been resolved in version 1.1.1 ๐ŸŽ‰

The release is available on:

Your GitReleaseManager bot ๐Ÿ“ฆ๐Ÿš€