mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-26 02:04:37 +08:00
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:
1 parent
dd3cb10414
commit
5f76e65359
10 files changed
+99
-47
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user