fix(execution): track native read progress and retry transient library redraws
This commit is contained in:
1 parent
e74ec5bcbd
commit
911afdf1cc
7 files changed
+198
-8
No files matched your search
@@ -172,18 +172,25 @@ Sub QPNativeRequireContext(ByVal Project, ByVal Sheet, ByVal Guid)
|
||||
End Sub
|
||||
|
||||
Function QPBuildNativeSnapshotScript(ByVal Source, ByRef SelectedUids, ByVal Token, ByVal Project, ByVal Sheet, ByVal Guid, ByVal ResultPath, ByVal StopToken, ByVal Safe)
|
||||
Dim Header, Body, Names, Name, Uid, Pattern, Matches
|
||||
Dim Header, Body, Names, Name, Uid, Pattern, Matches, MonitorJob
|
||||
Header = Left(Source, InStr(Source, "Set QP_Fso =") - 1)
|
||||
Set Pattern = CreateObject("VBScript.RegExp")
|
||||
Pattern.Global = True
|
||||
Pattern.MultiLine = True
|
||||
Pattern.Pattern = "^Const (VDM_COMP|VDM_COMPPIN|VD_ALL) = [^\r\n]*\r?\n"
|
||||
Header = Pattern.Replace(Header, "")
|
||||
MonitorJob = QP_ExpectedJobId
|
||||
If QP_SessionMode Then MonitorJob = QP_MonitorJobId
|
||||
Body = Header & vbCrLf & "Dim QP_NR_Selected, QP_NR_Text, QP_NR_Code, QP_NR_Source, QP_NR_Description, QP_NR_Safe" & vbCrLf & _
|
||||
"Dim QP_NR_MonitorJob, QP_NR_CurrentJob, QP_NR_ParentSequence, QP_NR_Sequence, QP_NR_LastProgress" & vbCrLf & _
|
||||
"Set QP_Fso=CreateObject(""Scripting.FileSystemObject"")" & vbCrLf & _
|
||||
"QP_Root=" & QPNativeExpression(QP_Root) & vbCrLf & _
|
||||
"QP_AttemptToken=" & QPNativeExpression(StopToken) & vbCrLf & _
|
||||
"QP_NR_Safe=" & CStr(CBool(Safe)) & vbCrLf & _
|
||||
"QP_NR_MonitorJob=" & QPNativeExpression(MonitorJob) & vbCrLf & _
|
||||
"QP_NR_CurrentJob=" & QPNativeExpression(QP_ExpectedJobId) & vbCrLf & _
|
||||
"QP_NR_ParentSequence=" & CStr(CLng(QP_ProgressSequence) + 1) & vbCrLf & _
|
||||
"QP_NR_Sequence=0:QP_NR_LastProgress=-1" & vbCrLf & _
|
||||
"Set QP_NR_Selected=CreateObject(""Scripting.Dictionary"")" & vbCrLf
|
||||
For Each Uid In SelectedUids.Keys
|
||||
Body = Body & "QP_NR_Selected.Add " & QPNativeExpression(Uid) & ",True" & vbCrLf
|
||||
@@ -207,12 +214,26 @@ Function QPBuildNativeSnapshotScript(ByVal Source, ByRef SelectedUids, ByVal Tok
|
||||
Next
|
||||
Body = Body & vbCrLf & "Sub QPLog(ByVal Root,ByVal Level,ByVal Message)" & vbCrLf & "End Sub" & vbCrLf & _
|
||||
"Sub QPProgress(ByVal Stage,ByVal Done,ByVal Total)" & vbCrLf & _
|
||||
" Dim StopPath" & vbCrLf & _
|
||||
" Dim StopPath,Elapsed,CurrentTime,ProgressPath,Stream,SafeFlag" & vbCrLf & _
|
||||
" If QP_NR_Safe And Len(QP_AttemptToken)>0 Then" & vbCrLf & _
|
||||
" StopPath=QP_Fso.BuildPath(QP_Root,""monitor-"" & QP_AttemptToken & "".stop"")" & vbCrLf & _
|
||||
" If QP_Fso.FileExists(StopPath) Then" & vbCrLf & _
|
||||
" If Trim(QPReadUtf8(StopPath))=QP_AttemptToken Then Err.Raise vbObjectError+860,""QuickPartReplace.SafeStop"",""native read stopped at safe boundary""" & vbCrLf & _
|
||||
" End If" & vbCrLf & " End If" & vbCrLf & "End Sub" & vbCrLf
|
||||
" End If" & vbCrLf & " End If" & vbCrLf & _
|
||||
" If Len(QP_AttemptToken)=0 Then Exit Sub" & vbCrLf & _
|
||||
" CurrentTime=Timer:Elapsed=CurrentTime-QP_NR_LastProgress" & vbCrLf & _
|
||||
" If Elapsed<0 Then Elapsed=Elapsed+86400" & vbCrLf & _
|
||||
" If QP_NR_LastProgress>=0 And Elapsed<1 And Not (Total>0 And Done=Total) Then Exit Sub" & vbCrLf & _
|
||||
" SafeFlag=0:If QP_NR_Safe Then SafeFlag=1" & vbCrLf & _
|
||||
" QP_NR_Sequence=QP_NR_Sequence+1" & vbCrLf & _
|
||||
" ProgressPath=QP_Fso.BuildPath(QP_Root,""monitor-"" & QP_AttemptToken & "".native-progress"")" & vbCrLf & _
|
||||
" On Error Resume Next" & vbCrLf & _
|
||||
" Set Stream=QP_Fso.CreateTextFile(ProgressPath,True,False)" & vbCrLf & _
|
||||
" Stream.WriteLine ""DX_NATIVE_PROGRESS"" & vbTab & QP_AttemptToken & vbTab & QP_NR_MonitorJob & vbTab & _" & vbCrLf & _
|
||||
" CStr(QP_NR_ParentSequence) & vbTab & QP_NR_CurrentJob & vbTab & CStr(QP_NR_Sequence) & vbTab & _" & vbCrLf & _
|
||||
" CStr(Done) & vbTab & CStr(Total) & vbTab & CStr(SafeFlag)" & vbCrLf & _
|
||||
" Stream.Close:Err.Clear" & vbCrLf & " On Error GoTo 0" & vbCrLf & _
|
||||
" QP_NR_LastProgress=CurrentTime" & vbCrLf & "End Sub" & vbCrLf
|
||||
QPBuildNativeSnapshotScript = Body
|
||||
End Function
|
||||
|
||||
|
||||
Reference in new issue
Block a user