From eaf0b8037dca2d78ca25c71a0a056bf3e3dd91fd Mon Sep 17 00:00:00 2001
From: karnem <mikhail.karnevskiy@desy.de>
Date: Wed, 17 Jul 2019 14:19:21 +0200
Subject: [PATCH] Refactoring

---
 cal_tools/cal_tools/tools.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/cal_tools/cal_tools/tools.py b/cal_tools/cal_tools/tools.py
index db7977329..f4f7f0939 100644
--- a/cal_tools/cal_tools/tools.py
+++ b/cal_tools/cal_tools/tools.py
@@ -489,13 +489,12 @@ def get_from_db(device, constant, condition, empty_constant,
                 metadata.retrieve(this_interface, timeout=timeout,
                                   meta_only=meta_only)
                 break
+            except zmq.error.Again:
+                ntries -= 1
             except Exception as e:
                 if verbosity > 0:
                     print(e)
-                if isinstance(e, zmq.error.Again):
-                    ntries -= 1
-                else:
-                    ntries = 0
+                ntries = 0
 
         if ntries > 0:
             if verbosity > 0:
-- 
GitLab