From: Marius Gavrilescu Date: Sat, 8 Feb 2014 18:42:33 +0000 (+0200) Subject: Support multiple space-separated purge hosts X-Git-Tag: 5999.000_002~8 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=82657f577602c92f72c1030465ada83053e95e8d;p=gruntmaster-daemon.git Support multiple space-separated purge hosts --- 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{