From 5055da9105f15419bcae475301297a3455d86b9e Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 7 Jul 2021 16:20:51 +0900 Subject: [PATCH] Replace deprecated tenacity.Retrying.call ... by the __call__ method following the deprecation in the tenacity library[1]. [1] https://github.com/jd/tenacity/commit/d66af82a70dd9af24a7953c6ae5f02d8f198d10f Change-Id: I718afc9cc7f8ed672e039ce17ed75472cea428bb --- mistral/utils/rest_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mistral/utils/rest_utils.py b/mistral/utils/rest_utils.py index f56b4fa81..6cae86b7c 100644 --- a/mistral/utils/rest_utils.py +++ b/mistral/utils/rest_utils.py @@ -256,12 +256,15 @@ def get_all(list_cls, cls, get_all_function, get_function, class MistralRetrying(tenacity.Retrying): - def call(self, fn, *args, **kwargs): + def __call__(self, fn, *args, **kwargs): try: - return super(MistralRetrying, self).call(fn, *args, **kwargs) + return super(MistralRetrying, self).__call__(fn, *args, **kwargs) except tenacity.RetryError: raise exc.MistralError("The service is temporarily unavailable") + def call(self, fn, *args, **kwargs): + return self.__call__(fn, *args, **kwargs) + def create_db_retry_object(): return MistralRetrying(