From a7516a949c37dca39141dee7baeb72b01f262b29 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Tue, 21 Aug 2007 19:36:35 +0000 Subject: remove cache after reading it --- lib/Smokeping/Slave.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/Slave.pm b/lib/Smokeping/Slave.pm index e5ddb5d..6b693cb 100644 --- a/lib/Smokeping/Slave.pm +++ b/lib/Smokeping/Slave.pm @@ -64,10 +64,11 @@ sub submit_results { my $store = $slave_cfg->{cache_dir}."/data"; $store .= "_$myprobe" if $myprobe; $store .= ".cache"; - my $restore = retrieve $store if -f $store; + my $restore = -f $store ? retrieve $store : []; + unlink $store; my $data = get_results($slave_cfg, $cfg, $probes, $cfg->{Targets}, '', $myprobe); - push @$data, @$restore if $restore; - my $data_dump = join("\n",@{$data}) || ""; + push @$restore, @$data; + my $data_dump = join("\n",@{$restore}) || ""; my $ua = LWP::UserAgent->new( agent => 'smokeping-slave/1.0', timeout => 10, -- cgit v1.2.3-24-g4f1b