fix: preserve safe stop and explicit forced interruption lifecycle
This commit is contained in:
1 parent
b939101565
commit
9c03cd5900
29 files changed
+1829
-86
No files matched your search
@@ -28,7 +28,7 @@ Dim QP_ComponentUidIndex, QP_ComponentRefdesIndex, QP_ComponentLocationIndex
|
||||
Dim QP_ComponentIndexContext
|
||||
Dim QP_NativeCallActive
|
||||
Dim QP_BatchMode, QP_OwnedProject, QP_BatchState, QP_BatchCode, QP_BatchMessage
|
||||
Dim QP_BatchSaveCommitted
|
||||
Dim QP_BatchSaveCommitted, QP_BatchSaveRequested
|
||||
Dim QP_DiscoveryMode, QP_TargetSchematic, QP_TargetSheet
|
||||
Dim QP_FailureNumber, QP_FailureSource, QP_FailureDescription
|
||||
Dim QP_NcSyncSummary
|
||||
@@ -60,6 +60,7 @@ QP_BatchMode = False
|
||||
QP_OwnedProject = False
|
||||
QP_BatchState = ""
|
||||
QP_BatchSaveCommitted = False
|
||||
QP_BatchSaveRequested = False
|
||||
QP_DiscoveryMode = False
|
||||
QP_TargetSchematic = ""
|
||||
QP_TargetSheet = ""
|
||||
@@ -110,6 +111,10 @@ Else
|
||||
QP_FailureDescription = Err.Description
|
||||
If QP_DiscoveryMode Then QPCleanupDiscoveryFailure
|
||||
FailureState = "hard_failure"
|
||||
If QP_BatchSaveRequested Then
|
||||
FailureState = "batch_saved_unverified"
|
||||
QP_FailureDescription = "save was requested; persisted outcome requires reconciliation. " & QP_FailureDescription
|
||||
End If
|
||||
CloseError = ""
|
||||
If QP_BatchMode Or QP_SessionMode Then
|
||||
QPDiscardFailedBatchProject CloseError
|
||||
@@ -318,6 +323,7 @@ Sub QPSessionNext()
|
||||
QP_BatchMode = True
|
||||
QP_BatchState = ""
|
||||
QP_BatchSaveCommitted = False
|
||||
QP_BatchSaveRequested = False
|
||||
QP_NativeMutationPossible = False
|
||||
If Trim(QPReadUtf8(QP_Fso.BuildPath(QP_Root, "batch.request"))) <> QP_ExpectedJobId Then _
|
||||
Err.Raise vbObjectError + 873, "QuickPartReplace.ProjectSession", "next batch authorization mismatch"
|
||||
@@ -872,12 +878,21 @@ Sub QPCloseBatchProject(ByVal ExpectedPath, ByVal SaveChanges)
|
||||
If Documents.Count <> 1 Then Err.Raise vbObjectError + 871, "QuickPartReplace.Batch", "open sheet set changed; no automatic close"
|
||||
Set Document = Documents.Item(1)
|
||||
QPProgress "save_and_close", 0, 1
|
||||
If SaveChanges Then
|
||||
QP_BatchSaveRequested = True
|
||||
QPLog QP_Root, "INFO", "save_requested job=" & QP_CurrentJobId
|
||||
End If
|
||||
Document.Close CBool(SaveChanges), ""
|
||||
If SaveChanges Then
|
||||
QP_BatchSaveCommitted = True
|
||||
QPLog QP_Root, "INFO", "save_returned job=" & QP_CurrentJobId
|
||||
End If
|
||||
If QPCanonicalPath(QPProjectPath()) <> QPCanonicalPath(ExpectedPath) Then _
|
||||
Err.Raise vbObjectError + 871, "QuickPartReplace.Batch", "project changed during sheet save"
|
||||
QP_App.CloseProject
|
||||
If Len(CStr(QP_App.GetProjectData().GetProjectFilePath())) > 0 Then _
|
||||
Err.Raise vbObjectError + 871, "QuickPartReplace.Batch", "project did not close; queue stopped"
|
||||
QPLog QP_Root, "INFO", "project_closed job=" & QP_CurrentJobId
|
||||
QP_OwnedProject = False
|
||||
QP_OwnedProjectPath = ""
|
||||
QPInvalidatePinIndex
|
||||
@@ -888,6 +903,10 @@ Sub QPDiscardFailedBatchProject(ByRef ErrorDescription)
|
||||
Dim ErrorNumber, ErrorSource, Description
|
||||
ErrorDescription = ""
|
||||
If (Not QP_BatchMode And Not QP_SessionMode) Or Not QP_OwnedProject Or QP_App Is Nothing Then Exit Sub
|
||||
If QP_NativeMutationPossible Or QP_BatchSaveRequested Or QP_BatchSaveCommitted Then
|
||||
ErrorDescription = "write or save outcome requires reconciliation; owned project retained without automatic save or discard"
|
||||
Exit Sub
|
||||
End If
|
||||
On Error Resume Next
|
||||
QPCloseBatchProject QP_OwnedProjectPath, False
|
||||
ErrorNumber = Err.Number
|
||||
@@ -932,7 +951,6 @@ Sub QPFinishBatchItem()
|
||||
If FinalState = "restored_ok" Then
|
||||
QPMarkBatchMutation Command
|
||||
QPCloseBatchProject TargetPath, True
|
||||
QP_BatchSaveCommitted = True
|
||||
ElseIf Not QP_SessionMode Then
|
||||
QPCloseBatchProject TargetPath, False
|
||||
End If
|
||||
@@ -952,6 +970,7 @@ Sub QPFinishBatchItem()
|
||||
QPVerifyRestoredPlans Command, Records, Plans, ValueStates
|
||||
If Not QP_SessionMode Then QPCloseBatchProject TargetPath, False
|
||||
FinalState = "saved_ok"
|
||||
QPLog QP_Root, "INFO", "saved_readback_verified job=" & QP_CurrentJobId
|
||||
If QP_SessionMode Then
|
||||
QP_BatchMessage = QP_BatchMessage & " Saved and reopened for readback; owned project checkpoint verified."
|
||||
Else
|
||||
|
||||
Reference in new issue
Block a user