Repository navigation
fix #95 Detach the written log entities without detaching the process execution - #96
Merged
Merged
Conversation
…out cascading to the process execution The Monolog records were detached instead of the LogRecord entities: the identity map grew with every log during long processes. LogRecord::$processExecution cascade reduced from `all` to `persist`: with the `detach` cascade, the current process execution was detached too, then inserted again by the next ProcessExecutionManager::save(). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #95.
DoctrineProcessHandler::flush(): keeps theLogRecordentities created from the buffered records and detaches them after the flush; the loop detaching the Monolog records (no effect) is removedLogRecord::$processExecution: cascade reduced fromalltopersist, so that detaching a log entity does not detach the currentProcessExecution(which the nextProcessExecutionManager::save()would insert again, silently). ORM level only: no schema change, no migration (doctrine:schema:update --dump-sqloutput identical with and without this change)Tests:
DoctrineProcessHandlerEntityManagerTest(new, entity manager of the test application, SQLite): 3 batches of 100 records; after each flush, noLogRecordleft in the identity map and the process execution still managed; thensave()updates the execution instead of inserting it again (a singlefinishrow, 300 log records attached to it)DoctrineProcessHandlerTest: only the persisted log entities are detached; nothing is detached without a current process executionChecked:
allkept), it fails too (process execution no longer managed). PHPStan, PHP-CS-Fixer, Rector OKdemo.loggerends with thefinishstatus and its logs attachedRequirements
Breaking changes
None in practice: only an application removing or refreshing
LogRecordentities and relying on the cascade to their process execution would be affected (already a dangerous behaviour: withonDelete: CASCADE, removing one log record removed the execution and all its logs).🤖 Generated with Claude Code