[LON-CAPA-cvs] cvs: loncom / loncron

raeburn raeburn at source.lon-capa.org
Fri Oct 28 10:26:15 EDT 2011


raeburn		Fri Oct 28 14:26:15 2011 EDT

  Modified files:              
    /loncom	loncron 
  Log:
  - 20s timeout when attempting to contact each server with an entry in  
    /home/httpd/sockets/delayed. 
  
  
Index: loncom/loncron
diff -u loncom/loncron:1.90 loncom/loncron:1.91
--- loncom/loncron:1.90	Fri Jun  3 20:45:10 2011
+++ loncom/loncron	Fri Oct 28 14:26:15 2011
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.90 2011/06/03 20:45:10 raeburn Exp $
+# $Id: loncron,v 1.91 2011/10/28 14:26:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -652,8 +652,18 @@
 # pong to all servers that have delayed messages
 # this will trigger a reverse connection, which should flush the buffers
     foreach my $tryserver (keys %servers) {
-	my $answer=&Apache::lonnet::reply("pong",$tryserver);
-	&log($fh,"Pong to $tryserver: $answer<br />");
+        my $answer;
+        eval {
+            local $SIG{ ALRM } = sub { die "TIMEOUT" };
+            alarm(20);
+            $answer = &Apache::lonnet::reply("pong",$tryserver);
+            alarm(0);
+        };
+        if ($@ && $@ =~ m/TIMEOUT/) {
+             print "time out while contacting: $tryserver for pong\n";
+        } else {
+	     &log($fh,"Pong to $tryserver: $answer<br />");
+        }
     }
 }
 




More information about the LON-CAPA-cvs mailing list