From 3f641e37b99d5aa18ecf2f58364696ac17f859d2 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Thu, 23 Aug 2007 20:58:01 +0000 Subject: * improved handling of slave updates * added median/sdev to graphs --- lib/Smokeping/Master.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/Master.pm b/lib/Smokeping/Master.pm index 10333a8..ddd708e 100644 --- a/lib/Smokeping/Master.pm +++ b/lib/Smokeping/Master.pm @@ -139,14 +139,14 @@ sub get_slaveupdates { my $data; if ( open (my $hand, '<', $file) ) { if ( flock $hand, LOCK_EX ){ - eval { $data = fd_retrieve $hand }; + rename $file,$file.$$; + eval { $data = fd_retrieve $hand }; + unlink $file.$$; + flock $hand, LOCK_UN; if ($@) { #error warn "Loading $file: $@"; return; } - seek $hand, 0,0; - truncate $hand, 0; - flock $hand, LOCK_UN; } else { warn "Could not lock $file. Can't load data.\n"; } -- cgit v1.2.3-24-g4f1b