From 82657f577602c92f72c1030465ada83053e95e8d Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 8 Feb 2014 20:42:33 +0200 Subject: [PATCH] Support multiple space-separated purge hosts --- lib/Gruntmaster/Daemon.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index 3f4e15a..82da6b8 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -23,6 +23,7 @@ use constant PAGE_SIZE => 10; ################################################## my $ua = LWP::UserAgent->new; +my @purge_hosts = exists $ENV{PURGE_HOSTS} ? split ' ', $ENV{PURGE_HOSTS} : (); sub safe_can_nodie { my ($type, $sub, $name) = @_; @@ -41,9 +42,10 @@ sub safe_can { } sub purge { - return unless $ENV{PURGE_HOST}; - my $req = HTTP::Request->new(PURGE => "http://$ENV{PURGE_HOST}$_[0]"); - $ua->request($req) + for my $host (@purge_hosts) { + my $req = HTTP::Request->new(PURGE => "http://$host$_[0]"); + $ua->request($req) + } } sub process{ -- 2.39.2