fix(contribution): run sequential CDC consumption in background
Prevents blocking NestJS onModuleInit during CDC sync by running the sequential consumption in the background with error handling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d58e8b44ee
commit
a01fd3aa86
|
|
@ -297,10 +297,12 @@ export class CDCConsumerService implements OnModuleInit, OnModuleDestroy {
|
|||
this.sequentialMode = true;
|
||||
this.isRunning = true;
|
||||
|
||||
// 开始顺序消费
|
||||
await this.startSequentialConsumption();
|
||||
// 开始顺序消费(后台运行,不阻塞服务启动)
|
||||
this.startSequentialConsumption().catch((error) => {
|
||||
this.logger.error('Sequential consumption failed', error);
|
||||
});
|
||||
|
||||
this.logger.log('CDC consumer started with sequential phase consumption');
|
||||
this.logger.log('CDC consumer started with sequential phase consumption (running in background)');
|
||||
} catch (error) {
|
||||
this.logger.error('Failed to start CDC consumer', error);
|
||||
// 不抛出错误,允许服务在没有 Kafka 的情况下启动(用于本地开发)
|
||||
|
|
|
|||
Loading…
Reference in New Issue