From ab30b5f1d27ca41c2b4b07f20c6cb19f4cf5612f Mon Sep 17 00:00:00 2001 From: backbord Date: Wed, 14 Sep 2022 14:14:48 +0200 Subject: [PATCH] Retries for _query_cvd_version_dns. Fixes #49. --- cvdupdate/cvdupdate.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cvdupdate/cvdupdate.py b/cvdupdate/cvdupdate.py index 4d5b8df..1d10e22 100644 --- a/cvdupdate/cvdupdate.py +++ b/cvdupdate/cvdupdate.py @@ -548,7 +548,12 @@ def _query_cvd_version_dns(self, db: str) -> int: if self.dns_version_tokens == []: # Query DNS if we haven't already - self._query_dns_txt_entry() + for _attempt in range(self.config['max retry']): + if self._query_dns_txt_entry(): + break + # Pause before next attempt. + time.sleep(0.1) + if self.dns_version_tokens == []: # Query failed. Bail out. return version