From 00fd83191c4c36f5a8835654baf05bfb8a4178ad Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 23 Nov 2016 20:11:12 +0200 Subject: [PATCH] avoiding race conditions in case if another process already raised retry-after delay we need to re-check the headers --- zenpy/lib/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zenpy/lib/api.py b/zenpy/lib/api.py index f732d884..759e9d75 100644 --- a/zenpy/lib/api.py +++ b/zenpy/lib/api.py @@ -67,7 +67,7 @@ def _call_api(self, http_method, url, **kwargs): retry_after_seconds -= 1 log.debug(" -> sleeping: %s more seconds" % retry_after_seconds) sleep(1) - response = http_method(url, **kwargs) + return self._call_api(self, http_method, url, **kwargs) return self._check_and_cache_response(response) def _get_items(self, endpoint, object_type, *args, **kwargs):