mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
feat:工作流手动中止
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import copy
|
||||
|
||||
from app.actions import BaseAction
|
||||
from app.core.config import global_vars
|
||||
from app.schemas import ActionParams, ActionContext
|
||||
from app.core.event import eventmanager
|
||||
|
||||
@@ -36,7 +37,7 @@ class SendEventAction(BaseAction):
|
||||
def success(self) -> bool:
|
||||
return self.done
|
||||
|
||||
def execute(self, params: dict, context: ActionContext) -> ActionContext:
|
||||
def execute(self, workflow_id: int, params: dict, context: ActionContext) -> ActionContext:
|
||||
"""
|
||||
发送events中的事件
|
||||
"""
|
||||
@@ -44,6 +45,8 @@ class SendEventAction(BaseAction):
|
||||
# 按优先级排序,优先级高的先发送
|
||||
context.events.sort(key=lambda x: x.priority, reverse=True)
|
||||
for event in copy.deepcopy(context.events):
|
||||
if global_vars.is_workflow_stopped(workflow_id):
|
||||
break
|
||||
eventmanager.send_event(etype=event.event_type, data=event.event_data)
|
||||
context.events.remove(event)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user