diff --git a/app/run.py b/app/run.py index 863611e..9f2cf7e 100644 --- a/app/run.py +++ b/app/run.py @@ -1855,8 +1855,12 @@ def run_script_now(): if tasklist: process_env["TASKLIST"] = json.dumps(tasklist, ensure_ascii=False) # 添加原始任务索引的环境变量 - if len(tasklist) == 1 and 'original_index' in request.json: - process_env["ORIGINAL_TASK_INDEX"] = str(request.json['original_index']) + if len(tasklist) == 1: + # 单任务手动运行:前端传入 original_index,用于日志展示 + if 'original_index' in request.json: + process_env["ORIGINAL_TASK_INDEX"] = str(request.json['original_index']) + # 单任务手动运行应忽略执行周期和任务进度限制(包括自动模式下进度100%也要执行) + process_env["IGNORE_EXECUTION_RULES"] = "1" process = subprocess.Popen( command, stdout=subprocess.PIPE, diff --git a/quark_auto_save.py b/quark_auto_save.py index ec8b776..9673fff 100644 --- a/quark_auto_save.py +++ b/quark_auto_save.py @@ -4466,7 +4466,7 @@ def do_sign(account): print() -def do_save(account, tasklist=[]): +def do_save(account, tasklist=[], ignore_execution_rules=False): print(f"🧩 载入插件") plugins, CONFIG_DATA["plugins"], task_plugins_config = Config.load_plugins( CONFIG_DATA.get("plugins", {}) @@ -4479,6 +4479,9 @@ def do_save(account, tasklist=[]): sent_notices = set() def is_time(task): + # 若为手动单任务运行并明确要求忽略执行周期/进度限制,则始终执行 + if ignore_execution_rules: + return True # 获取任务的执行周期模式,优先使用任务自身的execution_mode,否则使用系统配置的execution_mode execution_mode = task.get("execution_mode") or CONFIG_DATA.get("execution_mode", "manual") @@ -5892,9 +5895,12 @@ def main(): print(f"===============转存任务===============") # 任务列表 if tasklist_from_env: - do_save(accounts[0], tasklist_from_env) + # 若通过环境变量传入任务列表,视为手动运行,可由外层控制是否忽略执行周期/进度限制 + ignore_execution_rules = os.environ.get("IGNORE_EXECUTION_RULES", "").lower() in ["1", "true", "yes"] + do_save(accounts[0], tasklist_from_env, ignore_execution_rules=ignore_execution_rules) else: - do_save(accounts[0], CONFIG_DATA.get("tasklist", [])) + # 定时任务或命令行全量运行,始终遵循执行周期/进度规则 + do_save(accounts[0], CONFIG_DATA.get("tasklist", []), ignore_execution_rules=False) print() # 通知 if NOTIFYS: