From 9c16eba485f7a6b1a5fba017f4f4e5cd89b9a087 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 26 May 2025 07:53:57 +0200 Subject: [PATCH] cache-html: Fractional sleep & run after cron --- util/cache-html.pl | 4 ++-- util/cron.sh | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/util/cache-html.pl b/util/cache-html.pl index 51c6bf4..216785f 100755 --- a/util/cache-html.pl +++ b/util/cache-html.pl @@ -21,7 +21,7 @@ use v5.36; use FU::Pg; use Getopt::Long; -use Time::HiRes 'time'; +use Time::HiRes 'time', 'sleep'; use Cwd 'abs_path'; our $ROOT; BEGIN { ($ROOT = abs_path $0) =~ s{/util/cache-html\.pl$}{}; } @@ -33,7 +33,7 @@ my $verbose = 0; my $delay = 0; my $batch = 1; my $maxbatches = 0; -GetOptions('verbose' => \$verbose, 'delay=i' => \$delay, 'batch=i' => \$batch, 'maxbatches=i' => \$maxbatches); +GetOptions('verbose' => \$verbose, 'delay=f' => \$delay, 'batch=i' => \$batch, 'maxbatches=i' => \$maxbatches); my $conn = FU::Pg->connect($ENV{MANNED_PG}//''); diff --git a/util/cron.sh b/util/cron.sh index 1da2321..4487061 100755 --- a/util/cron.sh +++ b/util/cron.sh @@ -12,3 +12,7 @@ PSQL="psql -U manned -Awtq" echo "============ Updating SQL indices" $PSQL -f update_indices.sql + +echo "============ Updating HTML cache" +test -f .config && source ./.config +./cache-html.pl --batch=5 --delay=0.5 --maxbatches=100