fix(referral-service): 修复 Kafka 消费异常被吞掉的问题
- kafka.service.ts: 抛出异常让 KafkaJS 触发重试 - user-registered.handler.ts: 传播异常到 KafkaService 修复前处理失败的消息不会重试,导致推荐关系可能丢失 🤖 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
b5ebf8a615
commit
7d3483b565
|
|
@ -88,6 +88,7 @@ export class UserRegisteredHandler implements OnModuleInit {
|
||||||
`Failed to create referral relationship for accountSequence=${payload.accountSequence}:`,
|
`Failed to create referral relationship for accountSequence=${payload.accountSequence}:`,
|
||||||
error,
|
error,
|
||||||
);
|
);
|
||||||
|
throw error; // 传播异常,让 Kafka 重试
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ export class KafkaService implements OnModuleInit, OnModuleDestroy {
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(`Error processing message from ${topic}:`, error);
|
this.logger.error(`Error processing message from ${topic}:`, error);
|
||||||
|
throw error; // 让 KafkaJS 知道处理失败,触发重试
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue