Skip to content

Commit 2e580ba

Browse files
author
Dave Rawks
committed
Fixed uncaught divbyzero wrapped in a lock which was causing a periodic deadlock
1 parent 1943183 commit 2e580ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

memcached/python_modules/memcached.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ def metric_of(self, name):
106106
if name in self.last_metric:
107107
num = self.metric[name]-self.last_metric[name]
108108
period = self.metric[mp+"_time"]-self.last_metric[mp+"_time"]
109-
val = num/period
109+
try:
110+
val = num/period
111+
except ZeroDivisionError:
112+
val = 0
110113
_Lock.release()
111114
elif name in self.metric:
112115
_Lock.acquire()

0 commit comments

Comments
 (0)