add SANDBOX_EXPIRED_RECORDS_RETENTION_DAYS

This commit is contained in:
hjlarry 2025-12-17 15:09:46 +08:00
parent fbeb35fbb5
commit fc2d024512
2 changed files with 11 additions and 4 deletions

View File

@ -1161,6 +1161,10 @@ class SandboxExpiredRecordsCleanConfig(BaseSettings):
description="Maximum number of records to process in each batch",
default=1000,
)
SANDBOX_EXPIRED_RECORDS_RETENTION_DAYS: PositiveInt = Field(
description="Retention days for sandbox expired workflow_run records and message records",
default=30,
)
class PositionConfig(BaseSettings):
@ -1310,7 +1314,7 @@ class FeatureConfig(
PositionConfig,
RagEtlConfig,
RepositoryConfig,
SandboxRecordsCleanConfig,
SandboxExpiredRecordsCleanConfig,
SecurityConfig,
TenantIsolatedTaskQueueConfig,
ToolConfig,

View File

@ -14,8 +14,11 @@ def clean_workflow_runs_task() -> None:
"""
click.echo(
click.style(
f"Scheduled workflow run cleanup starting: cutoff={dify_config.WORKFLOW_LOG_RETENTION_DAYS} days, "
f"batch={dify_config.WORKFLOW_LOG_CLEANUP_BATCH_SIZE}",
(
"Scheduled workflow run cleanup starting: "
f"cutoff={dify_config.SANDBOX_EXPIRED_RECORDS_RETENTION_DAYS} days, "
f"batch={dify_config.WORKFLOW_LOG_CLEANUP_BATCH_SIZE}"
),
fg="green",
)
)
@ -23,7 +26,7 @@ def clean_workflow_runs_task() -> None:
start_time = datetime.now(UTC)
WorkflowRunCleanup(
days=dify_config.WORKFLOW_LOG_RETENTION_DAYS,
days=dify_config.SANDBOX_EXPIRED_RECORDS_RETENTION_DAYS,
batch_size=dify_config.WORKFLOW_LOG_CLEANUP_BATCH_SIZE,
start_after=None,
end_before=None,