Skip to content

Conversation

@ranguard
Copy link
Member

@ranguard ranguard commented Jun 4, 2025

IF reach the main /end we enable

$c->cdn_stale_while_revalidate('1d'); $c->cdn_stale_if_error('1y'); 

These only take effect if cdn_max_age has been set

Also added caching on /search - which is where most of our traffic ends up

https://www.fastly.com/documentation/guides/concepts/edge-state/cache/stale/ shows the timeline

oalders
oalders previously approved these changes Jun 4, 2025
@oalders oalders force-pushed the leo/better_cache branch 3 times, most recently from 8596da9 to 8b9ac53 Compare June 4, 2025 23:44
@oalders oalders force-pushed the leo/better_cache branch from 0fae059 to 5271a8e Compare June 5, 2025 22:45
@codecov
Copy link

codecov bot commented Jun 7, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.48%. Comparing base (da9c6dc) to head (381833f).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
lib/MetaCPAN/Web/Controller/Pod.pm 0.00% 1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## master #3374 +/- ## ========================================== + Coverage 73.37% 73.48% +0.11%  ========================================== Files 68 67 -1 Lines 2385 2346 -39 Branches 334 331 -3 ========================================== - Hits 1750 1724 -26  + Misses 507 496 -11  + Partials 128 126 -2 
Files with missing lines Coverage Δ
lib/MetaCPAN/Middleware/OldUrls.pm 55.26% <ø> (ø)
lib/MetaCPAN/Web/Controller/About.pm 63.63% <ø> (+4.17%) ⬆️
lib/MetaCPAN/Web/Controller/Feed.pm 89.65% <100.00%> (+0.53%) ⬆️
lib/MetaCPAN/Web/Controller/Release.pm 90.19% <100.00%> (ø)
lib/MetaCPAN/Web/Controller/Root.pm 76.78% <100.00%> (+0.85%) ⬆️
lib/MetaCPAN/Web/Controller/Search.pm 82.00% <100.00%> (+0.75%) ⬆️
lib/MetaCPAN/Web/Controller/Pod.pm 70.58% <0.00%> (-2.14%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@ranguard ranguard force-pushed the leo/better_cache branch from 115d573 to 9c8e023 Compare June 7, 2025 10:13
@ranguard ranguard requested a review from oalders June 7, 2025 10:13
@ranguard ranguard requested a review from haarg June 7, 2025 14:41
my $release = $c->stash->{release};

if ( $data->{directory} ) {
$c->cdn_max_age('1y');
Copy link
Member

Choose a reason for hiding this comment

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

This can end up being a redirect from a non-versioned path to a versioned path, and it doesn't have any surrogate keys so it won't get purged.

@ranguard ranguard requested a review from haarg June 7, 2025 16:22
@ranguard ranguard merged commit 65fe1f3 into master Jun 8, 2025
11 checks passed
@ranguard ranguard deleted the leo/better_cache branch June 8, 2025 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants