]> iEval git - gruntmaster-daemon.git/commitdiff
Support multiple space-separated purge hosts
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 8 Feb 2014 18:42:33 +0000 (20:42 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 8 Feb 2014 18:42:33 +0000 (20:42 +0200)
lib/Gruntmaster/Daemon.pm

index 3f4e15a5f2f4acf629a0c660ee7d4228ed5d0abc..82da6b8924791d53388d43191b4b8d26023bc6b4 100644 (file)
@@ -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{
This page took 0.023809 seconds and 4 git commands to generate.