From a22fc1631342e16b06183f8beba884c78252e9eb Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 29 Dec 2025 10:07:28 -0800 Subject: [PATCH] =?UTF-8?q?fix(session-coordinator):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20FindExpired=20SQL=20=E6=97=B6=E5=8C=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - expires_at 存储为 UTC 时间 - 查询时使用 NOW() AT TIME ZONE 'UTC' 确保时区一致 - 避免因时区差异导致 session 过早被标记为过期 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../adapters/output/postgres/session_postgres_repo.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/mpc-system/services/session-coordinator/adapters/output/postgres/session_postgres_repo.go b/backend/mpc-system/services/session-coordinator/adapters/output/postgres/session_postgres_repo.go index 2700d8d3..d8cb294d 100644 --- a/backend/mpc-system/services/session-coordinator/adapters/output/postgres/session_postgres_repo.go +++ b/backend/mpc-system/services/session-coordinator/adapters/output/postgres/session_postgres_repo.go @@ -207,13 +207,14 @@ func (r *SessionPostgresRepo) FindByStatus(ctx context.Context, status value_obj } // FindExpired retrieves all expired but not yet marked sessions +// Note: expires_at is stored in UTC, so we compare with NOW() AT TIME ZONE 'UTC' func (r *SessionPostgresRepo) FindExpired(ctx context.Context) ([]*entities.MPCSession, error) { rows, err := r.db.QueryContext(ctx, ` SELECT id, session_type, threshold_n, threshold_t, status, message_hash, public_key, delegate_party_id, keygen_session_id, created_by, created_at, updated_at, expires_at, completed_at, version, COALESCE(wallet_name, ''), COALESCE(invite_code, '') FROM mpc_sessions - WHERE expires_at < NOW() AND status IN ('created', 'in_progress') + WHERE expires_at < (NOW() AT TIME ZONE 'UTC') AND status IN ('created', 'in_progress') `) if err != nil { return nil, err