diff options
author | Tobi Oetiker <tobi@oetiker.ch> | 2007-08-21 21:36:35 +0200 |
---|---|---|
committer | Tobi Oetiker <tobi@oetiker.ch> | 2007-08-21 21:36:35 +0200 |
commit | a7516a949c37dca39141dee7baeb72b01f262b29 (patch) | |
tree | 4158d012f0cdf59620823c7f10bafa21ff9e888c /lib/Smokeping | |
parent | 4909ade650a31797ee4d305565a91061e8a5b812 (diff) | |
download | smokeping-a7516a949c37dca39141dee7baeb72b01f262b29.tar.gz smokeping-a7516a949c37dca39141dee7baeb72b01f262b29.tar.xz |
remove cache after reading it
Diffstat (limited to 'lib/Smokeping')
-rw-r--r-- | lib/Smokeping/Slave.pm | 7 |
1 files changed, 4 insertions, 3 deletions
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, |