diskwatcher.tac: don't report negative timeleft
authorBrian Warner <warner@lothar.com>
Thu, 7 Aug 2008 17:34:33 +0000 (10:34 -0700)
committerBrian Warner <warner@lothar.com>
Thu, 7 Aug 2008 17:34:33 +0000 (10:34 -0700)
misc/spacetime/diskwatcher.tac

index 15e5d47f45275332d1908a7e81b499fc95a58504..9780e2dd4d4d9ca771c18a32e68711cb9d5954e3 100644 (file)
@@ -160,10 +160,9 @@ class DiskWatcher(service.MultiService, resource.Resource):
             growth = self.growth(timespan)
             print name, total_avail_space, growth
             if growth is not None:
-                try:
+                timeleft = None
+                if growth > 0:
                     timeleft = total_avail_space / growth
-                except ZeroDivisionError:
-                    timeleft = None
                 timespans.append( (name, timespan, growth, timeleft) )
         return timespans