File tree Expand file tree Collapse file tree
packages/sync/server/postgres-node/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ type DocContext = {
9494
9595type PostgresNodeDocStore = {
9696 provider : WebSocketSyncServerDocProvider < Operation > ;
97- notifyDocUpdate : ( docId : string ) => void ;
97+ notifyDocUpdate : ( docId : string , ops ?: readonly Operation [ ] ) => void ;
9898 closeAll : ( ) => Promise < void > ;
9999} ;
100100
@@ -404,10 +404,10 @@ export function createPostgresNodeDocStore(opts: PostgresNodeDocStoreOptions): P
404404 let closing = false ;
405405 let closeAllPromise : Promise < void > | undefined ;
406406
407- const notifyDocUpdate = ( docId : string ) : void => {
407+ const notifyDocUpdate = ( docId : string , ops ?: readonly Operation [ ] ) : void => {
408408 const ctx = docs . get ( docId ) ;
409409 if ( ! ctx ) return ;
410- for ( const peer of ctx . peers ) void peer . notifyLocalUpdate ( ) ;
410+ for ( const peer of ctx . peers ) void peer . notifyLocalUpdate ( ops ) ;
411411 } ;
412412
413413 const closeBackend = async ( backend : SyncBackend < Operation > ) : Promise < void > => {
@@ -458,7 +458,9 @@ export function createPostgresNodeDocStore(opts: PostgresNodeDocStoreOptions): P
458458 } catch {
459459 // ignore notify failures; local update path still proceeds
460460 }
461- notifyDocUpdate ( ctx . docId ) ;
461+ // Local peers in this Node process can take the exact applied ops fast path.
462+ // Cross-process listeners still fall back to doc-level pg_notify invalidation.
463+ notifyDocUpdate ( ctx . docId , ops ) ;
462464 } ;
463465 return {
464466 ...backend ,
You can’t perform that action at this time.
0 commit comments