]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Check idl.run() return value before blocking
authorTerry Wilson <twilson@redhat.com>
Mon, 28 Sep 2015 22:42:25 +0000 (17:42 -0500)
committerTerry Wilson <twilson@redhat.com>
Tue, 29 Sep 2015 10:16:49 +0000 (05:16 -0500)
The IDL change_seqno can change as a result of running idl.run(), and
it returns True if there has been a change. The existing code would
block without checking the return value, and therefor could block
until another change occurred, or the timeout was reached.

Closes-Bug: #1501090
Change-Id: I9b7aac2755e6e6b69165023e01583337f9d30f15

neutron/agent/ovsdb/native/idlutils.py

index 22aa0008a363289cf03b41ee0f564ab0b7e099b6..b02acd30553df8a3f3d9446cbdf290896cc53705 100644 (file)
@@ -115,8 +115,7 @@ def wait_for_change(_idl, timeout, seqno=None):
     if seqno is None:
         seqno = _idl.change_seqno
     stop = time.time() + timeout
-    while _idl.change_seqno == seqno:
-        _idl.run()
+    while _idl.change_seqno == seqno and not _idl.run():
         ovs_poller = poller.Poller()
         _idl.wait(ovs_poller)
         ovs_poller.timer_wait(timeout * 1000)