From 5904f2f84d07de5cd12b71539a741ce2186f65bd Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 21 Dec 2025 21:40:04 -0800 Subject: [PATCH] fix: improve logging for wallet retry task and idempotent status updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change misleading "unexpected" log to correctly indicate idempotent behavior - Add debug log for completed records being skipped in retry task 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../application/event-handlers/blockchain-wallet.handler.ts | 2 +- .../src/application/tasks/wallet-retry.task.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/services/identity-service/src/application/event-handlers/blockchain-wallet.handler.ts b/backend/services/identity-service/src/application/event-handlers/blockchain-wallet.handler.ts index 30b71a57..87a5dda0 100644 --- a/backend/services/identity-service/src/application/event-handlers/blockchain-wallet.handler.ts +++ b/backend/services/identity-service/src/application/event-handlers/blockchain-wallet.handler.ts @@ -161,7 +161,7 @@ export class BlockchainWalletHandler implements OnModuleInit { ); } else { this.logger.log( - `[STATUS] Status not updated for user: ${userId} (unexpected - completed should always succeed)`, + `[STATUS] Status already 'completed' for user: ${userId} (idempotent - event redelivered)`, ); } diff --git a/backend/services/identity-service/src/application/tasks/wallet-retry.task.ts b/backend/services/identity-service/src/application/tasks/wallet-retry.task.ts index 3b9e3207..f6162a3d 100644 --- a/backend/services/identity-service/src/application/tasks/wallet-retry.task.ts +++ b/backend/services/identity-service/src/application/tasks/wallet-retry.task.ts @@ -120,6 +120,9 @@ export class WalletRetryTask { // 跳过已完成的 if (currentStatus === 'completed') { + this.logger.debug( + `[TASK] User ${userId} status is 'completed', skipping`, + ); return; }