Skip to content

Avoid repeated preindexed source refreshes#35

Merged
Gabriel Dufresne (GabrielDuf) merged 3 commits into
masterfrom
mamoreau-devolutions/pinget-show-benchmark
Jun 2, 2026
Merged

Avoid repeated preindexed source refreshes#35
Gabriel Dufresne (GabrielDuf) merged 3 commits into
masterfrom
mamoreau-devolutions/pinget-show-benchmark

Conversation

@mamoreau-devolutions

@mamoreau-devolutions Marc-André Moreau (mamoreau-devolutions) commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Use the freshest available source metadata or index.db timestamp when deciding whether a preindexed cache is stale.
  • Align the default preindexed auto-update interval with winget-cli: 15 minutes.
  • Add C# and Rust regression coverage for stale source metadata with a fresh local index.
  • Clean up Rust temporary index files when replacement fails.
  • Bump Pinget version surfaces to 0.8.2 via scripts\Set-PingetVersion.ps1 0.8.2.

WinGet comparison

WinGet checks source freshness before opening sources. For preindexed sources, it refreshes when there is no usable cached source package, or when the later of the cached source package version timestamp and source metadata LastUpdateTime is older than source.autoUpdateIntervalInMinutes. The default for that setting is 15 minutes; 0 disables auto-update. It also honors DoNotUpdateBefore to avoid retrying too soon after service throttling.

Pinget now mirrors the same practical behavior for its direct index.db cache: it refreshes when index.db is missing, or when the freshest available timestamp (LastUpdate metadata or index.db mtime) is older than the configured interval. Explicit source updates and explicit missing-version recovery can still force a refresh.

Benchmark

Final isolated pinget show Microsoft.PowerToys Release timing:

CLI Cold run Warm avg Warm cache changes
C# 1690.3 ms 534.1 ms 0
Rust 1725.2 ms 348.8 ms 0

Validation

  • dotnet test dotnet\src\Devolutions.Pinget.Core.Tests\Devolutions.Pinget.Core.Tests.csproj -c Release --nologo
  • cargo test -p pinget-core --manifest-path rust\Cargo.toml
  • cargo clippy -q --manifest-path rust\Cargo.toml --workspace --tests -- -D warnings
  • cargo build -p pinget-cli --manifest-path rust\Cargo.toml --release
  • dotnet test dotnet\src\Devolutions.Pinget.Core.Tests\Devolutions.Pinget.Core.Tests.csproj -c Release --filter "FullyQualifiedName~Show_PreindexedFreshIndexMtime|FullyQualifiedName~Show_PreindexedStaleIndex|FullyQualifiedName~Show_PreindexedExplicitMissingVersion|FullyQualifiedName~Show_PreindexedStaleIndex_WhenRefreshFails" --nologo
  • cargo test -p pinget-core --manifest-path rust\Cargo.toml preindexed_
  • cargo test -p pinget-core --manifest-path rust\Cargo.toml repository_options_capture_custom_host_settings
  • dotnet build dotnet\Devolutions.Pinget.slnx -c Release --nologo
  • cargo build -p pinget-cli --manifest-path rust\Cargo.toml
  • cargo build -p pinget-com --manifest-path rust\Cargo.toml

Use the freshest available source metadata or index.db timestamp when deciding whether a preindexed source cache is stale. Add C# and Rust regression coverage for stale metadata with a fresh index and clean up Rust temporary index files when replacement fails.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Set the default preindexed source auto-update interval to 15 minutes to match winget-cli's source.autoUpdateIntervalInMinutes default.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Run scripts/Set-PingetVersion.ps1 0.8.2 to update Rust, C#, PowerShell, and NuGet package version surfaces.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit 59a2a7f into master Jun 2, 2026
13 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the mamoreau-devolutions/pinget-show-benchmark branch June 2, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants