Revert "fix(contribution): run CDC sync in background to avoid blocking service startup"

This reverts commit 703c12e9f6.
This commit is contained in:
hailin 2026-01-13 21:44:18 -08:00
parent 703c12e9f6
commit 5a4970d7d9
1 changed files with 5 additions and 5 deletions

View File

@ -51,14 +51,14 @@ export class CDCEventDispatcher implements OnModuleInit {
this.handleAdoptionPostCommit.bind(this),
);
// 启动 CDC 消费者(非阻塞,在后台运行顺序同步)
// 不能 await否则会阻塞服务启动导致 HTTP 端点无法访问
this.cdcConsumer.start().then(() => {
// 启动 CDC 消费者
try {
await this.cdcConsumer.start();
this.logger.log('CDC event dispatcher started with transactional idempotency');
}).catch((error) => {
} catch (error) {
this.logger.error('Failed to start CDC event dispatcher', error);
// 不抛出错误,允许服务在没有 Kafka 的情况下启动(用于本地开发)
});
}
}
private async handleUserEvent(event: CDCEvent, tx: TransactionClient): Promise<void> {