zmirror: Fix buggy retries on subscribe failures.
(imported from commit 786cb63be5aa5889283a4cbbecafe58690ad4ac9)
This commit is contained in:
parent
506eac99d6
commit
a29f3b78b5
|
@ -148,22 +148,29 @@ for (stream, test) in test_streams:
|
||||||
else:
|
else:
|
||||||
zephyr_subs_to_add.append((stream, '*', '*'))
|
zephyr_subs_to_add.append((stream, '*', '*'))
|
||||||
|
|
||||||
|
actually_subscribed = False
|
||||||
for tries in xrange(10):
|
for tries in xrange(10):
|
||||||
try:
|
try:
|
||||||
zephyr.init()
|
zephyr.init()
|
||||||
zephyr._z.subAll(zephyr_subs_to_add)
|
zephyr._z.subAll(zephyr_subs_to_add)
|
||||||
zephyr_subs = zephyr._z.getSubscriptions()
|
zephyr_subs = zephyr._z.getSubscriptions()
|
||||||
|
|
||||||
|
missing = 0
|
||||||
for elt in zephyr_subs_to_add:
|
for elt in zephyr_subs_to_add:
|
||||||
if elt not in zephyr_subs:
|
if elt not in zephyr_subs:
|
||||||
logging.error("Failed to subscribe to %s" % (elt,))
|
logging.error("Failed to subscribe to %s" % (elt,))
|
||||||
continue
|
missing += 1
|
||||||
|
if missing == 0:
|
||||||
|
actually_subscribed = True
|
||||||
break
|
break
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
if tries > 5:
|
|
||||||
if "SERVNAK received" in e:
|
if "SERVNAK received" in e:
|
||||||
logger.error("SERVNAK repeatedly received, punting rest of test")
|
logger.error("SERVNAK repeatedly received, punting rest of test")
|
||||||
else:
|
else:
|
||||||
logger.exception("Exception subscribing to zephyrs")
|
logger.exception("Exception subscribing to zephyrs")
|
||||||
|
|
||||||
|
if not actually_subscribed:
|
||||||
|
logger.error("Failed to subscribe to zephyrs")
|
||||||
print_status_and_exit(1)
|
print_status_and_exit(1)
|
||||||
|
|
||||||
# Prepare keys
|
# Prepare keys
|
||||||
|
|
Loading…
Reference in a new issue