From d4f6b755e5b2c264d4b9e9d2b5e0eeb246cabb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B5=E6=91=87=E5=B0=8F=E5=AD=90?= <969409112@qq.com> Date: Sat, 11 Jul 2026 23:22:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Windows=20=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=B8=B8=E6=A0=87=E5=9B=9E=E9=80=80=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/wcdb4-client.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/wcdb4-client.ts b/src/main/wcdb4-client.ts index cc21c30..e8f718b 100644 --- a/src/main/wcdb4-client.ts +++ b/src/main/wcdb4-client.ts @@ -651,6 +651,16 @@ export class Wcdb4Client { console.warn(`[WCDB4] cursor messages failed username=${username}:`, error) } + if (maxRows) { + const tableRows = this.getMessagesByTableScan(username, startTime, endTime, maxRows) + if (tableRows.length > 0) { + console.log( + `[WCDB4] getMessages table scan ok username=${username} rows=${tableRows.length} cost=${Date.now() - startedAt}ms` + ) + return tableRows + } + } + if (!this.wcdbGetMessages) return [] const allRows: Record[] = [] @@ -806,11 +816,12 @@ export class Wcdb4Client { const cursorOut: WcdbHandleOut = [0] const begin = this.normalizeTimestamp(startTime || 0) const end = this.normalizeTimestamp(endTime || 0) + const ascending = limit ? 0 : 1 const openResult = this.wcdbOpenMessageCursor( handle, username, batchSize, - 1, + ascending, begin, end, cursorOut