[CalendarServer-changes] [1863] CalDAVTester/trunk/monitor.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 11 07:50:15 PDT 2007


Revision: 1863
          http://trac.macosforge.org/projects/calendarserver/changeset/1863
Author:   cdaboo at apple.com
Date:     2007-09-11 07:50:13 -0700 (Tue, 11 Sep 2007)

Log Message:
-----------
Add timeout on socket calls so that a non-response server generates errors.

Modified Paths:
--------------
    CalDAVTester/trunk/monitor.py

Modified: CalDAVTester/trunk/monitor.py
===================================================================
--- CalDAVTester/trunk/monitor.py	2007-09-11 03:20:43 UTC (rev 1862)
+++ CalDAVTester/trunk/monitor.py	2007-09-11 14:50:13 UTC (rev 1863)
@@ -22,6 +22,7 @@
 #
 
 from getpass import getpass
+import socket
 import datetime
 import signal
 import sys
@@ -125,17 +126,17 @@
                 break
             if self.minfo.logging:
                 self.logtxt("Result: %d, Timing: %.3f" % (result, timing,))
-            if timing >= self.minfo.warningtime:
-                msg = "WARNING: request time (%.3f) exceeds limit (%.3f)" % (timing, self.minfo.warningtime,)
+            if result != 0:
+                msg = "WARNING: request failed"
                 self.logtxt(msg)
-                if self.minfo.notify_time_exceeded and (time.time() - last_notify > self.minfo.notify_interval * 60):
+                if self.minfo.notify_request_failed and (time.time() - last_notify > self.minfo.notify_interval * 60):
                     self.logtxt("Sending notification to %s" % (self.minfo.notify,))
                     self.doNotification(msg)
                     last_notify = time.time()
-            if result != 0:
-                msg = "WARNING: request failed"
+            elif timing >= self.minfo.warningtime:
+                msg = "WARNING: request time (%.3f) exceeds limit (%.3f)" % (timing, self.minfo.warningtime,)
                 self.logtxt(msg)
-                if self.minfo.notify_request_failed and (time.time() - last_notify > self.minfo.notify_interval * 60):
+                if self.minfo.notify_time_exceeded and (time.time() - last_notify > self.minfo.notify_interval * 60):
                     self.logtxt("Sending notification to %s" % (self.minfo.notify,))
                     self.doNotification(msg)
                     last_notify = time.time()
@@ -162,6 +163,7 @@
         sys.exit()
 
     signal.signal(signal.SIGINT, signalEnd)
+    socket.setdefaulttimeout(120)    # Two minute timeout
 
     m.doStart()
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070911/fdf60d2b/attachment.html


More information about the calendarserver-changes mailing list