Fixed the issue for pop exception
Fixed the issue so that two threads do not pop the list at the same time Closes-Bug: #1283926 Change-Id: I693407495c18c3e4a0ca2d8d94c4f4ed179371bf
This commit is contained in:
parent
66bb4f3cc6
commit
076db925c8
|
@ -275,8 +275,11 @@ class TestRacyWaitForReply(test_utils.BaseTestCase):
|
|||
|
||||
def reply_waiter(self, msg_id, timeout):
|
||||
if wait_conditions:
|
||||
with wait_conditions[0]:
|
||||
wait_conditions.pop().wait()
|
||||
cond = wait_conditions.pop()
|
||||
with cond:
|
||||
cond.notify()
|
||||
with cond:
|
||||
cond.wait()
|
||||
return orig_reply_waiter(self, msg_id, timeout)
|
||||
|
||||
self.stubs.Set(amqpdriver.ReplyWaiter, 'wait', reply_waiter)
|
||||
|
@ -297,7 +300,9 @@ class TestRacyWaitForReply(test_utils.BaseTestCase):
|
|||
# Start the first guy, receive his message, but delay his polling
|
||||
notify_condition = threading.Condition()
|
||||
wait_conditions.append(notify_condition)
|
||||
senders[0].start()
|
||||
with notify_condition:
|
||||
senders[0].start()
|
||||
notify_condition.wait()
|
||||
|
||||
msgs.append(listener.poll())
|
||||
self.assertEqual(msgs[-1].message, {'tx_id': 0})
|
||||
|
|
Loading…
Reference in New Issue