14c869b Improve and fix timeout bug in wait_for_entry()

Authored and Committed by cheimes 5 years ago
    Improve and fix timeout bug in wait_for_entry()
    
    replication.wait_for_entry() now can wait for an attribute value to
    appear on a replica.
    
    Fixed timeout handling caused by bad rounding and comparison. For small
    timeouts, the actual time was rounded down. For example for 60 seconds
    timeout and fast replica, the query accumulated to about 0.45 seconds
    plus 60 seconds sleep. 60.45 is large enough to terminate the loop
    "while int(time.time()) < timeout", but not large enough to trigger the
    exception in "if int(time.time()) > timeout", because int(60.65) == 60.
    
    See: https://pagure.io/freeipa/issue/7593
    Fixes: https://pagure.io/freeipa/issue/7595
    Signed-off-by: Christian Heimes <cheimes@redhat.com>
    Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>