File tree Expand file tree Collapse file tree
internal-packages/run-engine/src/engine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1956,8 +1956,7 @@ export class RunEngine {
19561956 if ( useReplica && e instanceof ExecutionSnapshotNotFoundError ) {
19571957 // Replica lag: the runner learned this snapshot id from the writer before the
19581958 // replica caught up. Give the replica one jittered retry, then serve from the
1959- // writer; only count/warn if a retry succeeds (a permanent miss is a real error,
1960- // not lag).
1959+ // writer; a miss on the writer too is a real error, not lag.
19611960 const { minMs, maxMs } = this . snapshotsSinceReplicaRetryDelay ;
19621961 if ( maxMs > 0 ) {
19631962 await setTimeout ( minMs + Math . random ( ) * Math . max ( 0 , maxMs - minMs ) ) ;
@@ -1974,7 +1973,7 @@ export class RunEngine {
19741973 : replicaRetryError ,
19751974 runId,
19761975 snapshotId,
1977- retriedFromReplica : true ,
1976+ failedDuring : "replica_retry" ,
19781977 } ) ;
19791978 return null ;
19801979 }
@@ -1995,7 +1994,7 @@ export class RunEngine {
19951994 message : retryError instanceof Error ? retryError . message : retryError ,
19961995 runId,
19971996 snapshotId,
1998- retriedFromReplica : true ,
1997+ failedDuring : "primary_fallback" ,
19991998 } ) ;
20001999 return null ;
20012000 }
Original file line number Diff line number Diff line change @@ -989,6 +989,10 @@ describe("RunEngine getSnapshotsSince", () => {
989989
990990 const firstSnapshot = allSnapshots [ 0 ] ;
991991
992+ // Warm the replica connection so the engine's first attempt is a fast point
993+ // read - a cold Prisma connect could outlast the 100ms seeding window below.
994+ await schemaOnlyPrisma . $queryRaw `SELECT 1` ;
995+
992996 // Kick off the poll against the still-empty replica, then seed the replica
993997 // well before the ~400ms jittered retry fires - simulating the replica
994998 // catching up while the engine waits.
You can’t perform that action at this time.
0 commit comments