Repository navigation
#174 - Reset the process execution state between two messages of a worker - #178
Merged
Merged
Conversation
…rker - ProcessExecutionManager implements ResetInterface (kernel.reset tag): current and last process executions set to null. When the end of an execution failed before unsetProcessExecution(), the execution stayed the current one in the worker, and the next process was attached to it (setCurrentProcessExecution() keeps the current one). - DoctrineProcessHandler::reset() (kernel.reset tag) drops the records not written at the end of the previous execution (failed flush). - ProcessEventSubscriber: the ended execution is unset, and its log file closed, even when save() fails (try / finally); the error is still thrown, the ended event is not dispatched. ProcessHandler was already reset by Monolog (StreamHandler::reset() closes the file, Logger::reset() on kernel.reset). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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 #174.
ProcessExecutionManagerimplementsResetInterface(kernel.resettag): the current and last process executions are set tonullbetween two messages of a long-running worker (Messengerexecute_processtransport, scheduler). When the end of an execution failed beforeunsetProcessExecution(), the execution stayed the current one, and the next process executed by the worker was attached to it (setCurrentProcessExecution()keeps the current one): status, report, logs in database, stop requests.DoctrineProcessHandler::reset()(kernel.resettag) drops the log records not written at the end of the previous execution (failed flush), which would be attached to the next one.ProcessEventSubscriber::success()/fail(): the ended execution is unset, and its log file closed, even whensave()fails (try/finally). The error is still thrown; theProcessExecutionEndedEventis not dispatched in this case (as before).ProcessHandler(log file) was already reset by Monolog:StreamHandler::reset()closes the file (close()unsets the file name), called byLogger::reset()(kernel.resettag of the loggers). Same approach as cleverage/process-bundle#301 forProcessManager.Checked in process-bundle-demo (patch applied to the vendor):
debug:container --tag=kernel.reset:cleverage_ui_process.manager.process_executionandcleverage_ui_process.monolog_handler.doctrine_process(reset), withcleverage_process.manager.process;messenger:consume execute_processon a successful execution then a failed one (unknown process): two executions with their own status, log file and log records.The failed save scenario is covered by the unit tests (not reproducible in the demo without breaking the database).
Tests:
ProcessExecutionManager::reset(),DoctrineProcessHandler::reset(), end of an execution whose save fails (success and fail),kernel.resettags. With coverage (pcov): no risky test, no new uncovered line.Requirements
Breaking changes
None: new
reset()methods; the end of an execution behaves the same when its save succeeds.🤖 Generated with Claude Code