fix(sync): prevent race condition when adding new subscriptions

When a pullAllSessions was already running, the reloadTimer triggered
by adding sessions would be skipped by the source-level concurrency
lock, causing newly added sessions to wait until the next scheduled
interval (up to 60 minutes) before syncing.

Fix: trigger individual per-session pulls via triggerPull(sourceId,
sessionId) which bypasses the source-level lock, ensuring immediate
sync for newly added sessions regardless of concurrent pulls.

Also includes: connection pre-check on data source add, removal of
duplicate "browse remote sessions" button, hiding "other" session
types, and full resync fix for deleted local sessions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
diguaandCursor authored and digua committed 2026-05-22 10:20:39 +08:00
1 parent dd3cb10414
commit 5f76e65359
10 files changed
+99 -47

No files matched your search

+5
View File
@@ -77,6 +77,11 @@ export class DirectImporter implements DataImporter {
return this.incrementalImportFile(targetSessionId, tempFile)
}
if (targetSessionId) {
this.logger.info(`[DirectImporter] Session ${targetSessionId} not found locally, need full resync`)
return { success: false, newMessageCount: 0, needFullResync: true }
}
return this.fullImportFile(tempFile, externalId)
}
+3
View File
@@ -77,6 +77,9 @@ export function registerAutomationRoutes(server: FastifyInstance, ctx: SyncRoute
return reply.code(404).send({ error: 'Data source not found' })
}
reloadTimer(request.params.id, true)
for (const sess of added) {
pullEngine.triggerPull(request.params.id, sess.id).catch(() => {})
}
return added
})