From 9baef5f632cd9a3a0cd7d7acf88a6ea04273ee51 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Sun, 28 Apr 2024 12:19:07 +0100 Subject: [PATCH 1/3] remove prove and run scripts used in old infrastructure --- bin/prove | 3 --- bin/run | 10 ---------- 2 files changed, 13 deletions(-) delete mode 100755 bin/prove delete mode 100755 bin/run diff --git a/bin/prove b/bin/prove deleted file mode 100755 index 84c8753e7a2..00000000000 --- a/bin/prove +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -`dirname "$0"`/run prove -lrv "$@" diff --git a/bin/run b/bin/run deleted file mode 100755 index cfa395a73a0..00000000000 --- a/bin/run +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Use the puppet-installed wrapper to set up the env properly. -wrapper=$HOME/bin/metacpan-web-carton -test -x $wrapper && \ -exec $wrapper exec -- "$@" - -# If the wrapper doesn't exist, just try it with plain carton. -cd "`dirname "$0"`"/.. -exec carton exec -- "$@" From fa2c27d4f473af1c9654d27d490f3c5951a393a2 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Sun, 28 Apr 2024 12:20:43 +0100 Subject: [PATCH 2/3] remove purge script Purging can be trivially done using curl, and with a kubernetes deployment, running the purge script manually isn't reasonable. --- bin/purge.pl | 64 ---------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100755 bin/purge.pl diff --git a/bin/purge.pl b/bin/purge.pl deleted file mode 100755 index 85def9a3f82..00000000000 --- a/bin/purge.pl +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env perl - -use strict; - -# Purge stuff - -=head1 NAME - - purge.pl - -=head1 SYNOPSIS - - purge.pl --all - purge.pl --key homepage --key about - -=head1 DESCRIPTION - -Script to purge things from Fastly CDN. - -To clear a specific URL use: - - curl -X PURGE https://metacpan.org/XXXX - -=cut - -use File::Basename (); -use File::Spec (); -use lib File::Spec->catdir( File::Basename::dirname(__FILE__), - File::Spec->updir, 'lib' ); -use MetaCPAN::Web (); -use Getopt::Long::Descriptive qw( describe_options ); - -my ( $opt, $usage ) = describe_options( - 'purge.pl %o', - [ 'all', 'purge all', ], - [ 'key|k=s@', 'key(s) to purge', ], - [ 'list|l', 'list available cache keys' ], - [], - [ 'help', 'print usage message and exit' ], -); - -print( $usage->text ), exit if $opt->help; - -my $c = MetaCPAN::Web->new(); - -if ( $opt->all ) { - $c->cdn_purge_all(); - -} -elsif ( $opt->list ) { - ## no critic (MutatingList) - print grep { !/_cache_key_for_user/ } - map { s/\A.+:\s+\$c->add_surrogate_key\((.+?)\);\Z/$1/; $_ } - qx{git grep add_surrogate_key lib/MetaCPAN/Web/Controller/}; -} -else { - - my $keys = $opt->key; - - $c->cdn_purge_now( { - keys => $keys, - } ); - -} From 629d4816d98d7ecbda8e9579e5117f4e18f77312 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Sun, 28 Apr 2024 12:21:52 +0100 Subject: [PATCH 3/3] remove cache purging when updating favorites The API now purges on favorite changes, so there's no reason for the front end to do the same thing. --- lib/MetaCPAN/Web/Controller/Account/Favorite.pm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/MetaCPAN/Web/Controller/Account/Favorite.pm b/lib/MetaCPAN/Web/Controller/Account/Favorite.pm index 6dc47746995..a8781880e13 100644 --- a/lib/MetaCPAN/Web/Controller/Account/Favorite.pm +++ b/lib/MetaCPAN/Web/Controller/Account/Favorite.pm @@ -21,11 +21,6 @@ sub add : Local : Args(0) { $res = $user->add_favorite($data)->get; } - # We need to purge if the rating has changes until the fav count - # is moved from server to client side - $c->purge_author_key( $data->{author} ) if $data->{author}; - $c->purge_dist_key( $data->{distribution} ) if $data->{distribution}; - if ($json) { $c->res->code(400) if ( $res->{error} ); $c->stash->{json}{success} = $res->{error} ? \0 : \1;