diff --git a/backend/services/identity-service/src/application/services/user-application.service.ts b/backend/services/identity-service/src/application/services/user-application.service.ts index 1369018c..1e2f8854 100644 --- a/backend/services/identity-service/src/application/services/user-application.service.ts +++ b/backend/services/identity-service/src/application/services/user-application.service.ts @@ -1692,15 +1692,27 @@ export class UserApplicationService { try { const parsed = JSON.parse(currentStatusData); const status = parsed.status; + const updatedAt = parsed.updatedAt; - // 如果状态是 pending/generating/deriving,说明正在生成中,不触发重试 - if (status === 'pending' || status === 'generating' || status === 'deriving') { + // 检查状态是否超时(超过60秒未更新) + const TIMEOUT_MS = 60 * 1000; + const isTimeout = updatedAt && (Date.now() - new Date(updatedAt).getTime() > TIMEOUT_MS); + + // 如果状态是 pending/generating/deriving 且未超时,说明正在生成中,不触发重试 + if ((status === 'pending' || status === 'generating' || status === 'deriving') && !isTimeout) { this.logger.log( `[WALLET-RETRY] Wallet generation in progress (status=${status}) for user: ${userId}, skip retry`, ); return; // 正在生成中,无需重试 } + // 如果超时,记录日志并继续重试 + if (isTimeout) { + this.logger.log( + `[WALLET-RETRY] Status ${status} timed out for user: ${userId}, forcing retry`, + ); + } + // 如果状态是 completed,但数据库没有完整地址,说明是过期状态,继续重试 // 如果状态是 failed,允许重试 this.logger.log(