优化
This commit is contained in:
@@ -33,7 +33,7 @@ class _App:
|
||||
def open_function(self):
|
||||
pass
|
||||
|
||||
def _exec(rule, func, log_prefix = ""):
|
||||
def _exec(rule, func = [], log_prefix = "执行任务"):
|
||||
factor = getattr(rule, "factor")
|
||||
if hasattr(rule, "num"):
|
||||
num = getattr(rule, "num")
|
||||
@@ -43,7 +43,11 @@ def _exec(rule, func, log_prefix = ""):
|
||||
if factor > 0:
|
||||
wait_time = round(random.uniform(wait_time - factor, wait_time + factor), 2)
|
||||
print("{}:{}/{} ,停留 {} 秒".format(log_prefix, i, num, wait_time))
|
||||
func()
|
||||
if isinstance(func, list):
|
||||
for f in func:
|
||||
f()
|
||||
else:
|
||||
func()
|
||||
time.sleep(wait_time)
|
||||
i += 1
|
||||
return True
|
||||
|
Reference in New Issue
Block a user