Esempio n. 1
0
 def __wrapper(*args, **kwargs):
     timer = 0
     while (True):
         response = f(*args, **kwargs)
         if not str(response['status']).startswith('20'):
             if timer < times:
                 timer += 1
                 time.sleep(interval)
                 LOG.debug('retry time: %s' % timer)
                 continue
             else:
                 return response
         else:
             return response
Esempio n. 2
0
 def __wrapper(*args, **kwargs):
     timer = 0
     while True:
         response = f(*args, **kwargs)
         if not str(response["status"]).startswith("20"):
             if timer < times:
                 timer += 1
                 time.sleep(interval)
                 LOG.debug("retry time: %s" % timer)
                 continue
             else:
                 return response
         else:
             return response
Esempio n. 3
0
 def __wrapper(*args, **kwargs):
     timer = 0
     while(True):
         try:
             if timer <= times:
                 result = f(*args, **kwargs)
                 return result
         except Exception, e:
             LOG.debug('Do DB action Exception: %s' % traceback.format_exc())
             if timer < times:
                 timer += 1
                 time.sleep(interval)
                 LOG.error('Start to retry to do db action, TIME: %s' % timer)
                 continue
             else:
                 LOG.error('Do DB Exception: %s' % traceback.format_exc())
                 raise e
Esempio n. 4
0
 def __wrapper(*args, **kwargs):
     timer = 0
     while (True):
         try:
             if timer <= times:
                 result = f(*args, **kwargs)
                 return result
         except Exception, e:
             LOG.debug('Do DB action Exception: %s' %
                       traceback.format_exc())
             if timer < times:
                 timer += 1
                 time.sleep(interval)
                 LOG.error('Start to retry to do db action, TIME: %s' %
                           timer)
                 continue
             else:
                 LOG.error('Do DB Exception: %s' %
                           traceback.format_exc())
                 raise e