Merge "Avoid calling eventlet.event.Event.reset()"
This commit is contained in:
@@ -165,9 +165,7 @@ class EventletEvent(object):
|
|||||||
isSet = is_set
|
isSet = is_set
|
||||||
|
|
||||||
def set(self):
|
def set(self):
|
||||||
if self._set:
|
if not self._set:
|
||||||
self._event.reset()
|
|
||||||
|
|
||||||
self._set = True
|
self._set = True
|
||||||
self._event.send(True)
|
self._event.send(True)
|
||||||
|
|
||||||
|
|||||||
@@ -146,12 +146,11 @@ class EventletUtilsTest(test_base.BaseTestCase):
|
|||||||
self.assertTrue(hasattr(e_event, method))
|
self.assertTrue(hasattr(e_event, method))
|
||||||
|
|
||||||
# Ensure set() allows multiple invocations, same as in
|
# Ensure set() allows multiple invocations, same as in
|
||||||
# threading implementation. Must call reset on underlying
|
# threading implementation.
|
||||||
# Event before reusing it
|
|
||||||
e_event.set()
|
e_event.set()
|
||||||
self.assertEqual(0, mock_eventlet.event.Event().reset.call_count)
|
self.assertTrue(e_event.isSet())
|
||||||
e_event.set()
|
e_event.set()
|
||||||
self.assertEqual(1, mock_eventlet.event.Event().reset.call_count)
|
self.assertTrue(e_event.isSet())
|
||||||
|
|
||||||
def test_event_no_timeout(self):
|
def test_event_no_timeout(self):
|
||||||
event = eventletutils.EventletEvent()
|
event = eventletutils.EventletEvent()
|
||||||
|
|||||||
Reference in New Issue
Block a user