MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / WaitableTimer

Class WaitableTimer

cassandra/io/asyncorereactor.py:56–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54
55
56class WaitableTimer(Timer):
57 def __init__(self, timeout, callback):
58 Timer.__init__(self, timeout, callback)
59 self.callback = callback
60 self.event = Event()
61
62 self.final_exception = None
63
64 def finish(self, time_now):
65 try:
66 finished = Timer.finish(self, time_now)
67 if finished:
68 self.event.set()
69 return True
70 return False
71
72 except Exception as e:
73 self.final_exception = e
74 self.event.set()
75 return True
76
77 def wait(self, timeout=None):
78 self.event.wait(timeout)
79 if self.final_exception:
80 raise self.final_exception
81
82
83class _PipeWrapper(object):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected