Skip to content

Use the ptr727.Utilities resilient HTTP client for downloads#824

Merged
ptr727 merged 2 commits into
developfrom
feature/utilities-resilient-http
Jul 11, 2026
Merged

Use the ptr727.Utilities resilient HTTP client for downloads#824
ptr727 merged 2 commits into
developfrom
feature/utilities-resilient-http

Conversation

@ptr727

@ptr727 ptr727 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

Switch tool downloads and the app version check from a plain HttpClient to the resilient Download API in ptr727.Utilities v4 — retry with exponential backoff + jitter and a circuit breaker via Microsoft.Extensions.Http.Resilience (Polly).

Changes

  • Bump ptr727.Utilities 3.7.5 → 4.0.7.
  • Remove Program.GetHttpClient / CreateHttpClient / s_httpClient. The library's factory provides the 120 s timeout (default, matches prior) and a user-agent from the entry assembly (PlexCleaner/<version>, matches prior — so GitHub's API won't 403). Resilience/retry events log through the LogOptions factory already wired in Program.cs.
  • GitHubRelease / MkvMergeToolDownload.DownloadString. GetLatestRelease / GetLatestGitHubRelease now return bool with an out version; updated the four tool version-check callers and VerifyLatestVersion.
  • Tools.GetUrlInfoDownload.GetContentInfo (size + last-modified); Tools.DownloadFile delegates to Download.DownloadFile; the manual DownloadFileAsync is removed.

No functionality lost — v4's Download covers file/string/content-info, and the entry-assembly user-agent + 120 s timeout match the previous manual setup.

Verification

  • Build clean (0 warnings), 196 tests pass, formatters/linters green.
  • One-off network check confirmed Download.DownloadString reaches the GitHub releases API and returns valid JSON (user-agent works, no 403). The tool-download/auto-update paths are Windows-only, so they can't be driven on the Linux dev host, but they use the same verified Download API.

Bump ptr727.Utilities to 4.0.7 and replace the plain HttpClient with the
library's resilient Download API (Polly retry + circuit breaker via
Microsoft.Extensions.Http.Resilience).

- Remove Program.GetHttpClient/CreateHttpClient/s_httpClient. The library's
  factory sets the timeout (120s default) and a user-agent from the entry
  assembly (PlexCleaner/<version>), matching the previous behavior, and its
  resilience events log through the already-wired LogOptions factory.
- GitHubRelease and MkvMergeTool use Download.DownloadString; GetLatestRelease
  and GetLatestGitHubRelease now return a bool with an out version, updated at
  the four tool callers and VerifyLatestVersion.
- Tools.GetUrlInfo uses Download.GetContentInfo; Tools.DownloadFile delegates
  to Download.DownloadFile; the manual DownloadFileAsync is removed.
Copilot AI review requested due to automatic review settings July 11, 2026 00:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates PlexCleaner’s download/version-check HTTP usage from a manually configured HttpClient to the resilient ptr727.Utilities v4 Download API (retry/backoff + circuit breaker), affecting tool download/update flows and the app’s “latest version” check.

Changes:

  • Updated tool download helpers to use Download.GetContentInfo / Download.DownloadFile.
  • Updated GitHub release/version lookups to use Download.DownloadString and changed GetLatestRelease / GetLatestGitHubRelease to bool + out string.
  • Bumped ptr727.Utilities from 3.7.5 to 4.0.7 and documented the change in HISTORY.md.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
PlexCleaner/Tools.cs Replaced manual HTTP URL metadata lookup + file download implementation with ptr727.Utilities.Download APIs.
PlexCleaner/SevenZipTool.cs Updated GitHub release lookup to bool + out version pattern.
PlexCleaner/Program.cs Updated app “latest version” check to use new GitHubRelease.GetLatestRelease signature.
PlexCleaner/MkvMergeTool.cs Switched latest-version JSON fetch to Download.DownloadString.
PlexCleaner/MediaTool.cs Changed helper signature to GetLatestGitHubRelease(repo, out version) and delegates to GitHubRelease.
PlexCleaner/MediaInfoTool.cs Updated GitHub release lookup to bool + out version pattern.
PlexCleaner/HandBrakeTool.cs Updated GitHub release lookup to bool + out version pattern.
PlexCleaner/GitHubRelease.cs Switched GitHub API fetch to Download.DownloadString and changed API to bool + out version.
PlexCleaner/FfMpegTool.cs Updated GitHub release lookup to bool + out version pattern.
HISTORY.md Added release note describing migration to resilient download client.
Directory.Packages.props Bumped ptr727.Utilities package version to 4.0.7.

Comment thread PlexCleaner/Program.cs
Comment thread PlexCleaner/GitHubRelease.cs
Copilot AI review requested due to automatic review settings July 11, 2026 01:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit cca57a0 into develop Jul 11, 2026
15 checks passed
@ptr727
ptr727 deleted the feature/utilities-resilient-http branch July 11, 2026 01:08
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.

2 participants