diff --git a/backend/services/mining-wallet-service/src/infrastructure/kafka/consumers/burn.consumer.ts b/backend/services/mining-wallet-service/src/infrastructure/kafka/consumers/burn.consumer.ts index b42f0e30..cf73a3cd 100644 --- a/backend/services/mining-wallet-service/src/infrastructure/kafka/consumers/burn.consumer.ts +++ b/backend/services/mining-wallet-service/src/infrastructure/kafka/consumers/burn.consumer.ts @@ -97,6 +97,14 @@ export class BurnConsumer implements OnModuleInit { `Minute burn processed: amount=${burnAmount.toFixed(8)}, minute=${payload.burnMinute}`, ); } catch (error) { + // 余额不足时不重试,记录警告并跳过(避免无限重试) + if (error instanceof Error && error.message.includes('Insufficient pool balance')) { + this.logger.warn( + `Insufficient SHARE_POOL_A balance for minute burn ${eventId}, skipping. ${error.message}`, + ); + await this.markEventProcessed(eventId, 'burn.minute-executed:skipped:insufficient_balance'); + return; + } this.logger.error( `Failed to process minute burn event ${eventId}`, error instanceof Error ? error.stack : error, @@ -145,6 +153,14 @@ export class BurnConsumer implements OnModuleInit { `Sell burn processed: amount=${burnAmount.toFixed(8)}, account=${payload.sourceAccountSeq}`, ); } catch (error) { + // 余额不足时不重试,记录警告并跳过(避免无限重试) + if (error instanceof Error && error.message.includes('Insufficient pool balance')) { + this.logger.warn( + `Insufficient SHARE_POOL_A balance for sell burn ${eventId}, skipping. ${error.message}`, + ); + await this.markEventProcessed(eventId, 'burn.executed:skipped:insufficient_balance'); + return; + } this.logger.error( `Failed to process sell burn event ${eventId}`, error instanceof Error ? error.stack : error, diff --git a/backend/services/mining-wallet-service/src/infrastructure/kafka/consumers/mining-distribution.consumer.ts b/backend/services/mining-wallet-service/src/infrastructure/kafka/consumers/mining-distribution.consumer.ts index dd0ba92a..1c3e93ae 100644 --- a/backend/services/mining-wallet-service/src/infrastructure/kafka/consumers/mining-distribution.consumer.ts +++ b/backend/services/mining-wallet-service/src/infrastructure/kafka/consumers/mining-distribution.consumer.ts @@ -63,6 +63,14 @@ export class MiningDistributionConsumer implements OnModuleInit { `Mining distribution processed: minute=${event.payload.miningMinute}, amount=${event.payload.totalDistributed}`, ); } catch (error) { + // 余额不足时不重试,记录警告并跳过(避免无限重试) + if (error instanceof Error && error.message.includes('Insufficient pool balance')) { + this.logger.warn( + `Insufficient SHARE_POOL_B balance for mining distribution ${eventId}, skipping. ${error.message}`, + ); + await this.markEventProcessed(eventId, 'mining.distribution:skipped:insufficient_balance'); + return; + } this.logger.error( `Failed to process mining distribution for minute ${event.payload.miningMinute}`, error instanceof Error ? error.stack : error,