fix(worker): delegate production ddl to cd
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 59s
CD Pipeline / build-and-deploy (push) Successful in 7m9s
CD Pipeline / post-deploy-checks (push) Successful in 1m53s
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 59s
CD Pipeline / build-and-deploy (push) Successful in 7m9s
CD Pipeline / post-deploy-checks (push) Successful in 1m53s
This commit is contained in:
@@ -298,6 +298,13 @@ class Settings(BaseSettings):
|
||||
"processes that share a constrained production role."
|
||||
),
|
||||
)
|
||||
DATABASE_BOOTSTRAP_DDL_ENABLED: bool = Field(
|
||||
default=True,
|
||||
description=(
|
||||
"Run idempotent schema bootstrap DDL during process startup. "
|
||||
"Production workers disable this after CD migration preflight."
|
||||
),
|
||||
)
|
||||
|
||||
# ==========================================================================
|
||||
# Redis (192.168.0.188:6380, DB 0 - 與 OpenClaw 共用)
|
||||
|
||||
@@ -582,15 +582,26 @@ async def _main() -> None:
|
||||
await init_redis_pool()
|
||||
await init_worker_redis_pool() # Worker 專屬,無超時限制
|
||||
|
||||
# Initialize PostgreSQL (Episodic Memory) - 確保 incidents 表存在
|
||||
try:
|
||||
await init_db()
|
||||
logger.info("postgresql_initialized", status="ok")
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
"postgresql_init_failed",
|
||||
error=str(e),
|
||||
message="Episodic Memory (DB) will be unavailable - incidents won't persist",
|
||||
# Production schema ownership belongs to CD migration/preflight. Local and
|
||||
# development workers retain the idempotent bootstrap fallback by default.
|
||||
if settings.DATABASE_BOOTSTRAP_DDL_ENABLED:
|
||||
try:
|
||||
await init_db()
|
||||
logger.info("postgresql_initialized", status="ok")
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
"postgresql_init_failed",
|
||||
error=str(e),
|
||||
message=(
|
||||
"Episodic Memory (DB) will be unavailable - incidents "
|
||||
"won't persist"
|
||||
),
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
"database_bootstrap_ddl_skipped",
|
||||
owner="cd_migration_preflight",
|
||||
workload="signal_worker",
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user