It looks like it was executed once before the old process ended, and again after the new process started.
I don't know why the old process has to be executed once when it ends? This is obviously not its init phase.
What if the code here is sensitive to subway menu the number of executions (it cannot be repeated at will), then what should I do? ?
If the old process is executing again right before it ends, it could be due to cleanup or finalization code that’s triggering one last execution. To prevent unintended repeated executions, especially if the code is sensitive to this, here are some steps you can try:
Check the Termination Sequence: Review the shutdown/exit phase of the old process to see if there’s code that’s unintentionally re-triggering execution.
Add Execution Guards: Implement a flag (e.g., executed = false) that only allows the process to execute if it hasn’t already run. Once executed, set the flag to prevent any further runs.
Log Execution Points: Add logging around execution points to help pinpoint where and why the process is running again. This can clarify if it’s due to a particular phase or unexpected re-trigger.
Modify Code Sensitivity: If possible, modify the sensitive code to handle a final execution gracefully, especially if cleanup is necessary.
This approach should help control the process execution and avoid unintended repeats.