X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=lib%2FObject%2FRemote%2FWatchDog.pm;h=7e4d1fed52c1ae0a7fc6d58affc39bdf3574ebcc;hp=170b2b2151447993d9da08a15c64bc7a6341ce45;hb=5add5e29851e82862e4d8f6d67dfce559f6685ce;hpb=f129bfaf05b1ae0e2e2992cad47a70482dec9885 diff --git a/lib/Object/Remote/WatchDog.pm b/lib/Object/Remote/WatchDog.pm index 170b2b2..7e4d1fe 100644 --- a/lib/Object/Remote/WatchDog.pm +++ b/lib/Object/Remote/WatchDog.pm @@ -1,18 +1,20 @@ package Object::Remote::WatchDog; use Object::Remote::MiniLoop; -use Object::Remote::Logging qw ( :log :dlog ); +use Object::Remote::Logging qw (:log :dlog router); use Moo; has timeout => ( is => 'ro', required => 1 ); +BEGIN { router()->exclude_forwarding; } + around new => sub { my ($orig, $self, @args) = @_; our ($WATCHDOG); return $WATCHDOG if defined $WATCHDOG; log_trace { "Constructing new instance of global watchdog" }; - return $WATCHDOG = $self->$orig(@args); + return $WATCHDOG = $self->$orig(@args); }; #start the watchdog @@ -38,7 +40,7 @@ sub reset { die "Attempt to reset the watchdog before it was constructed" unless defined $WATCHDOG; - log_trace { "Watchdog has been reset" }; + log_debug { "Watchdog has been reset" }; alarm($WATCHDOG->timeout); } @@ -48,6 +50,7 @@ sub reset { #it makes sense to still terminate the process sub shutdown { my ($self) = @_; + log_debug { "Watchdog is shutting down" }; alarm(0); }