mirror of
https://github.com/langgenius/dify.git
synced 2026-04-19 18:27:27 +08:00
fix: restore SandboxExpiredRecordsCleanConfig, remove debug logs
- Restore SandboxExpiredRecordsCleanConfig (billing/ops config that was mistakenly removed with sandbox execution code) - Remove [DEBUG-AGENT] logging from app_generate_service.py Made-with: Cursor
This commit is contained in:
@ -1311,6 +1311,29 @@ class CollaborationConfig(BaseSettings):
|
||||
)
|
||||
|
||||
|
||||
class SandboxExpiredRecordsCleanConfig(BaseSettings):
|
||||
SANDBOX_EXPIRED_RECORDS_CLEAN_GRACEFUL_PERIOD: NonNegativeInt = Field(
|
||||
description="Graceful period in days for sandbox records clean after subscription expiration",
|
||||
default=21,
|
||||
)
|
||||
SANDBOX_EXPIRED_RECORDS_CLEAN_BATCH_SIZE: PositiveInt = Field(
|
||||
description="Maximum number of records to process in each batch",
|
||||
default=1000,
|
||||
)
|
||||
SANDBOX_EXPIRED_RECORDS_CLEAN_BATCH_MAX_INTERVAL: PositiveInt = Field(
|
||||
description="Maximum interval in milliseconds between batches",
|
||||
default=200,
|
||||
)
|
||||
SANDBOX_EXPIRED_RECORDS_RETENTION_DAYS: PositiveInt = Field(
|
||||
description="Retention days for sandbox expired workflow_run records and message records",
|
||||
default=30,
|
||||
)
|
||||
SANDBOX_EXPIRED_RECORDS_CLEAN_TASK_LOCK_TTL: PositiveInt = Field(
|
||||
description="Lock TTL for sandbox expired records clean task in seconds",
|
||||
default=90000,
|
||||
)
|
||||
|
||||
|
||||
class AgentV2UpgradeConfig(BaseSettings):
|
||||
"""Feature flags for transparent Agent V2 upgrade."""
|
||||
|
||||
@ -1431,6 +1454,7 @@ class FeatureConfig(
|
||||
WorkspaceConfig,
|
||||
CollaborationConfig,
|
||||
AgentV2UpgradeConfig,
|
||||
SandboxExpiredRecordsCleanConfig,
|
||||
LoginConfig,
|
||||
AccountConfig,
|
||||
SwaggerUIConfig,
|
||||
|
||||
@ -52,20 +52,15 @@ class AppGenerateService:
|
||||
nonlocal started
|
||||
with lock:
|
||||
if started:
|
||||
logger.info("[DEBUG-AGENT] _try_start: already started, skipping")
|
||||
return True
|
||||
try:
|
||||
logger.info("[DEBUG-AGENT] _try_start: calling start_task()...")
|
||||
start_task()
|
||||
logger.info("[DEBUG-AGENT] _try_start: start_task() succeeded")
|
||||
except Exception:
|
||||
logger.exception("[DEBUG-AGENT] _try_start: Failed to enqueue streaming task")
|
||||
return False
|
||||
started = True
|
||||
return True
|
||||
|
||||
channel_type = dify_config.PUBSUB_REDIS_CHANNEL_TYPE
|
||||
logger.info("[DEBUG-AGENT] channel_type=%s", channel_type)
|
||||
if channel_type == "streams":
|
||||
# With Redis Streams, we can safely start right away; consumers can read past events.
|
||||
_try_start()
|
||||
@ -228,10 +223,8 @@ class AppGenerateService:
|
||||
request_id=request_id,
|
||||
)
|
||||
case AppMode.AGENT:
|
||||
logger.info("[DEBUG-AGENT] Entered AGENT case, streaming=%s", streaming)
|
||||
workflow_id = args.get("workflow_id")
|
||||
workflow = cls._get_workflow(app_model, invoke_from, workflow_id)
|
||||
logger.info("[DEBUG-AGENT] Got workflow id=%s", workflow.id)
|
||||
|
||||
if streaming:
|
||||
with rate_limit_context(rate_limit, request_id):
|
||||
|
||||
Reference in New Issue
Block a user