ASYNC_WORKFLOW_SCHEDULER_GRANULARITY

This commit is contained in:
Yeuoly
2025-10-22 12:10:12 +08:00
parent c36173f5a9
commit 7f70d1de1c
5 changed files with 19 additions and 10 deletions

View File

@ -1,5 +1,6 @@
from core.workflow.graph_engine.layers.base import GraphEngineLayer
from core.workflow.graph_events.base import GraphEngineEvent
from core.workflow.graph_events.graph import GraphRunPausedEvent
class SuspendLayer(GraphEngineLayer):
@ -9,7 +10,11 @@ class SuspendLayer(GraphEngineLayer):
pass
def on_event(self, event: GraphEngineEvent):
pass
"""
Handle the paused event, stash runtime state into storage and wait for resume.
"""
if isinstance(event, GraphRunPausedEvent):
pass
def on_graph_end(self, error: Exception | None):
""" """

View File

@ -4,7 +4,6 @@ from typing import ClassVar
from apscheduler.schedulers.background import BackgroundScheduler # type: ignore
from configs import dify_config
from core.workflow.graph_engine.entities.commands import CommandType, GraphEngineCommand
from core.workflow.graph_engine.layers.base import GraphEngineLayer
from core.workflow.graph_events.base import GraphEngineEvent
@ -70,9 +69,7 @@ class TimeSliceLayer(GraphEngineLayer):
except Exception:
logger.exception("scheduler error during check if the workflow need to be suspended")
self.scheduler.add_job(
runner, "interval", seconds=dify_config.ASYNC_WORKFLOW_SCHEDULER_GRANULARITY, id=schedule_id
)
self.scheduler.add_job(runner, "interval", seconds=self.cfs_plan_scheduler.plan.granularity, id=schedule_id)
def on_event(self, event: GraphEngineEvent):
pass