[vhffs-dev] [1945] cron scheduler auto reconnect to backend feature added

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1945
Author:   gradator
Date:     2012-01-25 23:29:13 +0100 (Wed, 25 Jan 2012)
Log Message:
-----------
cron scheduler auto reconnect to backend feature added

Modified Paths:
--------------
    trunk/vhffs-cron/src/vhffscron.pl

Modified: trunk/vhffs-cron/src/vhffscron.pl
===================================================================
--- trunk/vhffs-cron/src/vhffscron.pl	2012-01-25 22:14:05 UTC (rev 1944)
+++ trunk/vhffs-cron/src/vhffscron.pl	2012-01-25 22:29:13 UTC (rev 1945)
@@ -58,9 +58,11 @@
 #select(STDOUT);
 #$| = 1;
 
-my $vhffs = init Vhffs::Main;
+my $vhffs = init Vhffs::Main( { backend => 'no' } );
 exit 1 unless defined $vhffs;
 
+$vhffs->connect;
+
 my $cronconf = $vhffs->get_config->get_service('cron');
 unless( defined $cronconf ) {
 	print 'Please add VHFFS configuration for this module'."\n";
@@ -89,6 +91,12 @@
 
 while(1)  {
 
+	# Reconnect to backend if necessary, do nothing if backend is down
+	unless( $vhffs->reconnect ) {
+		sleep 60;
+		next;
+	}
+
 	if( time() - $prevrun > int(rand 10)+5 )  {
 
 		# new jobs ?


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/