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
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);
}
#it makes sense to still terminate the process
sub shutdown {
my ($self) = @_;
+ log_debug { "Watchdog is shutting down" };
alarm(0);
}