mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-04-01 07:25:51 +00:00
fix: add forceReopen retry logic for openMessageCursorLite
This commit is contained in:
@@ -2681,7 +2681,7 @@ export class WcdbCore {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const outCursor = [0]
|
const outCursor = [0]
|
||||||
const result = this.wcdbOpenMessageCursorLite(
|
let result = this.wcdbOpenMessageCursorLite(
|
||||||
this.handle,
|
this.handle,
|
||||||
sessionId,
|
sessionId,
|
||||||
batchSize,
|
batchSize,
|
||||||
@@ -2690,6 +2690,29 @@ export class WcdbCore {
|
|||||||
endTimestamp,
|
endTimestamp,
|
||||||
outCursor
|
outCursor
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// result=-3 表示 WCDB_STATUS_NO_MESSAGE_DB:消息数据库缓存为空
|
||||||
|
// 自动强制重连并重试一次
|
||||||
|
if (result === -3 && outCursor[0] <= 0) {
|
||||||
|
this.writeLog('openMessageCursorLite: result=-3 (no message db), attempting forceReopen...', true)
|
||||||
|
const reopened = await this.forceReopen()
|
||||||
|
if (reopened && this.handle !== null) {
|
||||||
|
outCursor[0] = 0
|
||||||
|
result = this.wcdbOpenMessageCursorLite(
|
||||||
|
this.handle,
|
||||||
|
sessionId,
|
||||||
|
batchSize,
|
||||||
|
ascending ? 1 : 0,
|
||||||
|
beginTimestamp,
|
||||||
|
endTimestamp,
|
||||||
|
outCursor
|
||||||
|
)
|
||||||
|
this.writeLog(`openMessageCursorLite retry after forceReopen: result=${result} cursor=${outCursor[0]}`, true)
|
||||||
|
} else {
|
||||||
|
this.writeLog('openMessageCursorLite forceReopen failed, giving up', true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result !== 0 || outCursor[0] <= 0) {
|
if (result !== 0 || outCursor[0] <= 0) {
|
||||||
await this.printLogs(true)
|
await this.printLogs(true)
|
||||||
this.writeLog(
|
this.writeLog(
|
||||||
|
|||||||
Reference in New Issue
Block a user