Skip to content

fix: cache the update check timestamp when the version lookup fails - #3846

Merged
frostming merged 1 commit into
pdm-project:mainfrom
arose26:fix/3840-cache-failed-update-check
Aug 17, 2026
Merged

fix: cache the update check timestamp when the version lookup fails#3846
frostming merged 1 commit into
pdm-project:mainfrom
arose26:fix/3840-cache-failed-update-check

Conversation

@arose26

@arose26 arose26 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #3840

get_latest_version() returned early when the PyPI lookup raised, before writing
the last-check entry to the self-check cache. A failed check was therefore never
cached, so every subsequent command retried the request and waited out the
connection timeout again — making pdm appear to hang for users who are offline or
behind a restrictive network.

This records the check time whether or not the lookup succeeded, so a failure
backs off for the same expiry window as a success. latest-version is still only
written on success, so the cached-hit path now reads it with .get().

Added a regression test asserting that a second call within the expiry window does
not re-hit the network, plus a news fragment.

get_latest_version() returned early when the PyPI lookup raised, before
writing the "last-check" entry to the self-check cache. A failed check was
therefore never cached, so every subsequent command retried the request and
waited out the connection timeout again, making pdm appear to hang for users
who are offline or behind a restrictive network.

Record the check time whether or not the lookup succeeded, so a failure backs
off for the same expiry window as a success.

Fixes pdm-project#3840
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.36%. Comparing base (5a6ea88) to head (a8d5940).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3846   +/-   ##
=======================================
  Coverage   88.36%   88.36%           
=======================================
  Files         121      121           
  Lines       13249    13249           
  Branches     2251     2251           
=======================================
  Hits        11708    11708           
  Misses        969      969           
  Partials      572      572           
Flag Coverage Δ
unittests 88.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@frostming
frostming merged commit 48f7a76 into pdm-project:main Aug 17, 2026
25 checks passed
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.

Pdm hangs when running pdm config pypi.verify_ssl false

2 participants