fix: tolerate transient continuation read locks and record regression results

This commit is contained in:
阿白叔 committed 2026-10-15 16:44:33 +08:00
1 parent b47059587a
commit e655797e32
5 files changed
+111 -3

No files matched your search

+22 -1
View File
@@ -301,7 +301,7 @@ Sub QPSessionNext()
QPProgress "session_wait", 1, 1
For Attempt = 1 To 1500
If QP_Fso.FileExists(Path) Then
Fields = Split(Trim(QPReadUtf8(Path)), vbTab)
Fields = Split(Trim(QPReadContinuation(Path)), vbTab)
If UBound(Fields) <> 1 Then Err.Raise vbObjectError + 873, "QuickPartReplace.ProjectSession", "invalid continuation"
If Fields(0) <> QP_SessionToken Then Err.Raise vbObjectError + 873, "QuickPartReplace.ProjectSession", "continuation token mismatch"
QP_Fso.DeleteFile Path, True
@@ -2850,6 +2850,27 @@ Function QPReadUtf8(ByVal Path)
Stream.Close
End Function
Function QPReadContinuation(ByVal Path)
Dim Attempt, Text, Number, Description
' Atomic Windows replacement and background readers may briefly deny access.
' Only the continuation read retries; token and checkpoint checks remain strict.
For Attempt = 1 To 20
On Error Resume Next
Err.Clear
Text = QPReadUtf8(Path)
Number = Err.Number
Description = Err.Description
Err.Clear
On Error GoTo 0
If Number = 0 Then
QPReadContinuation = Text
Exit Function
End If
WScript.Sleep 50
Next
Err.Raise Number, "QuickPartReplace.ProjectSession", Description
End Function
Sub QPWriteUtf8(ByVal Path, ByVal Text)
Dim Stream
Set Stream = CreateObject("ADODB.Stream")