Skip to content

Commit

Permalink
log CDN purges
Browse files Browse the repository at this point in the history
The number of purges at Fastly seems very large. Logging the purges
should help track down why.
  • Loading branch information
haarg committed Feb 20, 2024
1 parent 6041879 commit 08afe6f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/MetaCPAN/Role/Script.pm
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,15 @@ sub are_you_sure {
return $iconfirmed;
}

before perform_purges => sub {
my ($self) = @_;
if ( $self->has_surrogate_keys_to_purge ) {
log_info {
"CDN Purge: " . join ', ', $self->surrogate_keys_to_purge;
};
}
};

1;

__END__
Expand Down
10 changes: 10 additions & 0 deletions lib/MetaCPAN/Server.pm
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ sub stash_or_detach {
['The requested info could not be found'] );
}

before perform_purges => sub {
my ($self) = @_;
if ( $self->has_surrogate_keys_to_purge ) {
my $log = $c->log;
return
unless $log->is_info;
$log->info( "CDN Purge: " . join( ', ', @keys ) );
}
};

1;

__END__

0 comments on commit 08afe6f

Please sign in to comment.