def retry_on_timeout(retries=1):
 def outer(func):
  @functools.wraps(func)
  def wrapped(*args, **kwargs):
   attempt = 0
   while True:
    try:
     return func(*args, **kwargs)
    except messaging.MessagingTimeout:
     attempt += 1
     if (attempt <= retries):
      LOG.warning(_LW('Retrying %(name)s after a MessagingTimeout, attempt %(attempt)s of %(retries)s.'), {'attempt': attempt, 'retries': retries, 'name': func.__name__})
     else:
      raise
  return wrapped
 return outer

def retry_on_timeout ( retries = 1 ) : def outer ( func ) : @ functools . wraps ( func ) def wrapped ( * args , ** kwargs ) : attempt = 0 while True : try : return func ( * args , ** kwargs ) except messaging . MessagingTimeout : attempt += 1 if ( attempt <= retries ) : LOG . warning ( _LW ( 'Retrying %(name)s after a MessagingTimeout, attempt %(attempt)s of %(retries)s.' ) , { 'attempt' : attempt , 'retries' : retries , 'name' : func . __name__ } ) else : raise return wrapped return outer
retry the call in case a messagingtimeout is raised .