Remove unnecessary workflow deletion logic when in the initial position

This commit is contained in:
Julien Fastré 2025-06-26 14:38:12 +02:00
parent a38116cca4
commit 0b580658de
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 6 additions and 5 deletions

View File

@ -0,0 +1,6 @@
kind: Feature
body: Do not remove workflow which are automatically canceled after staling for more than 30 days
time: 2025-06-26T14:37:35.267672192+02:00
custom:
Issue: ""
SchemaChange: No schema change

View File

@ -58,7 +58,6 @@ final readonly class CancelStaleWorkflowHandler
$transitions = $workflowComponent->getEnabledTransitions($workflow);
$transitionApplied = false;
$wasInInitialPosition = 'initial' === $workflow->getStep();
foreach ($transitions as $transition) {
if ($this->willTransitionLeadToFinalNegative($transition, $metadataStore)) {
@ -80,10 +79,6 @@ final readonly class CancelStaleWorkflowHandler
throw new UnrecoverableMessageHandlingException(sprintf('No valid transition found for EntityWorkflow %d.', $workflowId));
}
if ($wasInInitialPosition) {
$this->em->remove($workflow);
}
$this->em->flush();
}