Skip to content
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

Replace Invoke-WebRequest with .NET webclient to speed up downloads in Get-RemoteChecksum function #59

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

chrrobi
Copy link

@chrrobi chrrobi commented May 22, 2024

Description Of Changes

Updating the Get-RemoteChecksum function to leverage the .NET webclient vs
the Invoke-WebRequest to speed up the process significantly.

Motivation and Context

The current Get_RemoteChecksum implementation uses Invoke-WebRequest
which can be slow on larger files. This results in a long checksumming
process during automated packaging. By switching to the .NET webclient,
while losing the "interactive" download update (ie the ticker across the screen),
we significantly increase the speed of the download. For example, on a 150 mb
file, it went from minutes to download to seconds.

Testing

  1. This was tested locally on a windows 11 system using the ./update.sh and au_beforeupdate()
  2. This was tested within the chocolatey linux docker image using the ./update.sh and au_beforeupdate()

Operating Systems Testing

  • Windows 11 (Powershell 5)
  • chocolatey docker image with pwsh 7

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

Issue #58

Fixes #58

The current Get_RemoteChecksum implementation uses Invoke-WebRequest
which can be slow on larger files. This results in a long checksumming
process during automated packaging. By switching to the .NET webclient,
while losing the "interactive" download update, we significantly increase
the speed of the download. For example, on a 150 mb file, it went from minutes
to download to seconds.
* 'develop' of github.com:chrrobi/chocolatey-au:
  Change the way the file is downloaded to speed it up
The current Get_RemoteChecksum implementation uses Invoke-WebRequest
which can be slow on larger files. This results in a long checksumming
process during automated packaging. By switching to the .NET webclient,
while losing the "interactive" download update, we significantly increase
the speed of the download. For example, on a 150 mb file, it went from minutes
to download to seconds.

Added modified date in this commit
The current Get_RemoteChecksum implementation uses Invoke-WebRequest
with progress bar which can be slow on larger files. This results in a
long checksumming process during automated packaging. By providing the
option to hide the progress bar, while losing the "interactive" download
update, we significantly increase the speed of the download.
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.

Speed up Get_RemoteCheckSum
1 participant