From 691896db2d86afa7fd05e3a3c2db9485a2fa40aa Mon Sep 17 00:00:00 2001 From: LukeGus Date: Thu, 29 Oct 2026 12:46:42 -0500 Subject: [PATCH] fix: wake other clients after a sync push (Plugin-Sync#1) --- CHANGELOG.md | 1 + src/backend/sync/server/feed.ts | 2 +- src/backend/sync/server/push.ts | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bf637e2b..9b336d9f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - The log line for a rejected proxy login now shows the source address, so you can add it to TRUSTED_PROXY_AUTH_TRUSTED_PROXIES - Deleting your own account now removes all of its data, like an admin delete does, instead of leaving some behind - An SSH key with a passphrase is unlocked once and kept unlocked in memory for a short time, so connecting to many hosts with it no longer freezes the server for minutes +- A change pushed from one linked desktop or phone now reaches your other linked devices right away, instead of on their next check a few minutes later ## 26.10.5 diff --git a/src/backend/sync/server/feed.ts b/src/backend/sync/server/feed.ts index d1cf22780..75b84f541 100644 --- a/src/backend/sync/server/feed.ts +++ b/src/backend/sync/server/feed.ts @@ -161,7 +161,7 @@ async function reconcileListeners(): Promise { } } -function notifyListeners(userId: string): void { +export function notifyListeners(userId: string): void { const set = listeners.get(userId); if (!set) return; for (const res of set) { diff --git a/src/backend/sync/server/push.ts b/src/backend/sync/server/push.ts index 4cfc19579..2f74e2364 100644 --- a/src/backend/sync/server/push.ts +++ b/src/backend/sync/server/push.ts @@ -25,7 +25,7 @@ import { } from "../store.js"; import { allocateSeq, getRecord, putRecord, recordKey } from "../records.js"; import { orderSelfReferences } from "../wire.js"; -import { reconcileUser } from "./feed.js"; +import { markChanged, notifyListeners, reconcileUser } from "./feed.js"; export interface PushOp { entityType: string; @@ -278,6 +278,12 @@ export async function applyPush( // Refresh the snapshot so the next pull serves what was just written. await reconcileUser(userId, { force: true }); + // The reconcile finds nothing new, since the push wrote the records itself, + // so tell this user's other clients, and other users who may share a row. + if ([...results.values()].some((result) => result.status === "ok")) { + notifyListeners(userId); + markChanged(); + } return ops.map( (op) => results.get(recordKey(op.entityType, op.syncId)) ?? {