fix(identity-service): 修复钱包重试逻辑,超时状态允许强制重试
之前手动重试时如果状态是 generating/pending/deriving 会直接跳过, 导致卡住的钱包无法重新生成。现在增加超时检查(60秒),超时后允许强制重试。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
abc3b358a7
commit
aa180c54bc
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in New Issue