cold-import.service.ts
58.1 KB
-
fix(sync): cold-import Prisma 热路径加瞬时错误重试 · bcf26264
首次全量在 batch 183 因 prisma.patientTransaction.findMany() 报 "Response from the Engine was empty"(Prisma 引擎 socket 瞬时抖动)整轮 abort。 上次只给 ClickHouse 查询加了重试,Prisma 侧未覆盖。 补 withDbRetry 指数退避(0.5/1.5/4.5s),包裹 cold-import 写主循环里 会 re-throw 而中断整轮的 DB 调用:createMany / findMany(回查 tx)/ buildPatientIndex / ensurePatientStub / patient+profile upsert。 只重试已知瞬时类错误(empty engine / 连接池 / ECONNRESET / server closed / too many connections),P2002 等确定性错误立即抛交 caller。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
luoqi committed