diff options
author | Simon Westphahl <simon.westphahl@bmw.de> | 2021-10-05 10:56:23 +0200 |
---|---|---|
committer | Simon Westphahl <simon.westphahl@bmw.de> | 2021-10-26 07:30:08 +0200 |
commit | 02003c562638c67c9985ec9faa53bbada39b96d8 (patch) | |
tree | e936c3f1c0399647997383d54c5cbfeb039c9d9f /zuul/zk/zkobject.py | |
parent | 25ba52271bf21bb879859017983db1163426aeac (diff) | |
download | zuul-02003c562638c67c9985ec9faa53bbada39b96d8.tar.gz |
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
Diffstat (limited to 'zuul/zk/zkobject.py')
-rw-r--r-- | zuul/zk/zkobject.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/zuul/zk/zkobject.py b/zuul/zk/zkobject.py index 9534aa8d0..58aba7f14 100644 --- a/zuul/zk/zkobject.py +++ b/zuul/zk/zkobject.py @@ -16,7 +16,7 @@ import json import time import contextlib -from kazoo.exceptions import ZookeeperError +from kazoo.exceptions import KazooException, ZookeeperError class ZKContext: @@ -137,7 +137,7 @@ class ZKObject: # retryable. Connection errors are KazooExceptions so # they aren't caught here and we will retry. raise - except Exception: + except KazooException: context.log.exception( "Exception deleting ZKObject %s, will retry", self) time.sleep(self._retry_interval) @@ -165,7 +165,7 @@ class ZKObject: # retryable. Connection errors are KazooExceptions so # they aren't caught here and we will retry. raise - except Exception: + except KazooException: context.log.exception( "Exception loading ZKObject %s, will retry", self) time.sleep(5) @@ -189,7 +189,7 @@ class ZKObject: # retryable. Connection errors are KazooExceptions so # they aren't caught here and we will retry. raise - except Exception: + except KazooException: context.log.exception( "Exception saving ZKObject %s, will retry", self) time.sleep(self._retry_interval) |