MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / do_once

Method do_once

task.py:1790–1805  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1788 time.sleep(60)
1789
1790 def do_once(self):
1791 task_file_list = os.listdir(self.task_path)
1792 for file in task_file_list:
1793 try:
1794 filename = '{}/{}'.format(self.task_path, file)
1795 file_data = read_file(filename)
1796 if not file_data:
1797 os.remove(filename)
1798 continue
1799 data = json.loads(file_data)
1800 # 超过执行时间
1801 if time.time() > int(data['time']):
1802 self.proc_run_tasks_list(filename)
1803 except:
1804 err = traceback.format_exc()
1805 write_log("延时任务执行失败", err, _level='ERROR', color='red')
1806
1807 @staticmethod
1808 def proc_run_tasks_list(filename: str ):

Callers 1

startMethod · 0.95

Calls 8

proc_run_tasks_listMethod · 0.95
listdirMethod · 0.80
timeMethod · 0.80
read_fileFunction · 0.70
write_logFunction · 0.70
formatMethod · 0.45
removeMethod · 0.45
loadsMethod · 0.45

Tested by

no test coverage detected