retry
1 功能
2 例子
2.1 简单例子
from xlib.util import retry
print "------------------------------------------func"
@retry.retry(max_retries=3, interval=5)
def add(a, b):
return a + b
print add(3, 5)
print "------------------------------------------class"
class Demo():
@retry.retry(max_retries=3, interval=5)
def add(self, a, b):
assert a == 4
return a + b
demo = Demo()
print demo.add(3, 5)2.2 装饰器
2.3 添加超时时间
2.4 添加 exceptions 参数
Last updated