From 16be27e2840d3bc4b5ac7bc21efc2811c3e2cd61 Mon Sep 17 00:00:00 2001 From: Dacheng Xu Date: Sun, 22 Sep 2024 10:18:00 -0400 Subject: [PATCH] Use `RunDB.rundb_retry` in `XENON_CONFIG` to control number of retry (#129) --- utilix/rundb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utilix/rundb.py b/utilix/rundb.py index dfc5e23..051a6ea 100644 --- a/utilix/rundb.py +++ b/utilix/rundb.py @@ -108,8 +108,9 @@ def new_token(self): data = json.dumps({"username": username, "password": pw}) logger.debug("Creating a new token: doing API call now") # try making a new token 3 times + n_try = uconfig.get("RunDB", "rundb_retry", fallback=3) success = False - for _try in range(3): + for _try in range(n_try): try: response = requests.post(path, data=data, headers=BASE_HEADERS) response_json = json.loads(response.text)