Only retry ZK operations for Kazoo exceptions
The current ZKObject implementations retries indefinitely in case of an exception during delete, _load or _save. In case of some non-ZK related exeception (e.g. when deserializing the data) it doesn't make sense to retry as it will probably always fail. Change-Id: I7e06c6ba9c821ccbd25cdb1beab6539474ca9e13
This commit is contained in:
@@ -51,7 +51,7 @@ from tests.base import (
|
||||
from zuul.zk.zkobject import ZKObject, ZKContext
|
||||
from zuul.zk.locks import tenant_write_lock
|
||||
|
||||
from kazoo.exceptions import ZookeeperError
|
||||
from kazoo.exceptions import KazooException, ZookeeperError
|
||||
|
||||
|
||||
class ZooKeeperBaseTestCase(BaseTestCase):
|
||||
@@ -1518,7 +1518,7 @@ class TestZKObject(ZooKeeperBaseTestCase):
|
||||
def set(self, *args, **kw):
|
||||
self.count += 1
|
||||
if self.count < 2:
|
||||
raise Exception()
|
||||
raise KazooException()
|
||||
return self._real_client.set(*args, **kw)
|
||||
|
||||
# Fail an update
|
||||
|
||||
Reference in New Issue
Block a user