mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
feat(api): implement heartbeat mechanism for database migration lock
- Added a heartbeat function to renew the Redis lock during database migrations, preventing long blockages from crashed processes. - Updated the upgrade_db command to utilize the new locking mechanism with a configurable TTL. - Removed the deprecated MIGRATION_LOCK_TTL from DeploymentConfig and related files. - Enhanced unit tests to cover the new lock renewal behavior and error handling during migrations. (cherry picked from commit a3331c622435f9f215b95f6b0261f43ae56a9d9c)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
from pydantic import Field, PositiveInt
|
||||
from pydantic import Field
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
@ -33,7 +33,3 @@ class DeploymentConfig(BaseSettings):
|
||||
default="PRODUCTION",
|
||||
)
|
||||
|
||||
MIGRATION_LOCK_TTL: PositiveInt = Field(
|
||||
description="Redis lock TTL for startup DB migration (seconds). Increase for large/slow databases.",
|
||||
default=3600,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user