Replace deprecated tenacity.Retrying.call

... by the __call__ method following the deprecation in the tenacity
library[1].

[1] d66af82a70

Change-Id: I718afc9cc7f8ed672e039ce17ed75472cea428bb
This commit is contained in:
Takashi Kajinami 2021-07-07 16:20:51 +09:00
parent de880e801c
commit 5055da9105
1 changed files with 5 additions and 2 deletions

View File

@ -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(