Skip to content

Commit baee5c0

Browse files
author
A. Jesse Jiryu Davis
committed
Merge branch 'pr/190'
* pr/190: Compatibility fix: use isAlive instead of is_alive for python < 2.6 Raise exception if monitor thread died unexpectedly when refreshing (likely because of forking)
2 parents 8577ca1 + ed3adc2 commit baee5c0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pymongo/mongo_replica_set_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,14 @@ def __init__(self, rsc):
325325
# Track whether the thread has started. (Greenlets track this already.)
326326
self.started = False
327327

328+
def schedule_refresh(self):
329+
"""Override Monitor's schedule_refresh method
330+
raise exception as warning if thread is dead
331+
"""
332+
if not self.isAlive():
333+
raise Exception("Monitor thread died unexpectedly, used with fork?")
334+
super(MonitorThread, self).schedule_refresh()
335+
328336
def start(self):
329337
self.started = True
330338
super(MonitorThread, self).start()

0 commit comments

Comments
 (0)