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