mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-05-11 18:10:15 +08:00
fix workflow count
This commit is contained in:
@@ -156,7 +156,7 @@ def reset_workflow(workflow_id: int,
|
||||
# 停止工作流
|
||||
global_vars.stop_workflow(workflow_id)
|
||||
# 重置工作流
|
||||
workflow.reset(db, workflow_id)
|
||||
workflow.reset(db, workflow_id, reset_count=True)
|
||||
# 删除缓存
|
||||
SystemConfigOper().delete(f"WorkflowCache-{workflow_id}")
|
||||
return schemas.Response(success=True)
|
||||
|
||||
@@ -83,12 +83,12 @@ class Workflow(Base):
|
||||
|
||||
@staticmethod
|
||||
@db_update
|
||||
def reset(db, wid: int):
|
||||
def reset(db, wid: int, reset_count: bool = False):
|
||||
db.query(Workflow).filter(Workflow.id == wid).update({
|
||||
"state": 'W',
|
||||
"result": None,
|
||||
"current_action": None,
|
||||
"run_count": 0,
|
||||
"run_count": 0 if reset_count else Workflow.run_count,
|
||||
})
|
||||
return True
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ class WorkflowOper(DbOper):
|
||||
"""
|
||||
return Workflow.update_current_action(self._db, wid, action_id, context)
|
||||
|
||||
def reset(self, wid: int) -> bool:
|
||||
def reset(self, wid: int, reset_count: bool = False) -> bool:
|
||||
"""
|
||||
重置
|
||||
"""
|
||||
return Workflow.reset(self._db, wid)
|
||||
return Workflow.reset(self._db, wid, reset_count=reset_count)
|
||||
|
||||
Reference in New Issue
Block a user