def repeat(start_time, repeat_time):
if repeat_time < 1:
logging.error('Repeating function must have a repeat time greater than 1 second')
def repeat_inner(func):
return func
return repeat_inner
def repeat_inner(func):
@wraps(func)
def func_inner():
t = threading.Timer(repeat_time, func_inner)
t.daemon = True
t.start()
return func()
t = threading.Timer(start_time, func_inner)
t.daemon = True
t.start()
return func_inner
return repeat_inner
评论列表
文章目录