valtech / aem-easy-content-upgrade

AEM Easy Content Upgrade simplifies content migrations in AEM projects
Other
61 stars 25 forks source link

The second execution of the same script when it has not finished in the first run #185

Closed michal-tobiasz-wttech closed 2 years ago

michal-tobiasz-wttech commented 2 years ago

I have noticed during deployment in AEM as a cloud service in the history that a script that is set to execute only once was executed a second time. Looking at execution times the first execution started at 08:43:25 but there is a second execution at 08:43:49. Because one of my scripts takes about 3 minutes to complete then the second execution started during the execution of this script and executed it again. The effect of that was the second execution failed because it wanted to remove the node which was removed by the first execution.

Is it possible to avoid second execution? I'm a bit worried that current behaviour can cause some race conditions in script execution and unexpected results in scripts.

gruberrolandvaltech commented 2 years ago

This is a restriction of the way how AECU scripts are executed in the cloud:

As multiple AEM instances share the same repository scripts might be executed multiple times during the same deployment. Please make sure your scripts can handle this. Scripts with "always" selector might be executed at random times as cloud instances can be added/removed dynamically based on load.

michal-tobiasz-wttech commented 2 years ago

Yes, you are right. I thought that this script was executed on the same author instance again. I have delved into logs and saw that the second execution was from a different author instance. It starting to be really tricky now :)

gruberrolandvaltech commented 2 years ago

True. Hopefully, Adobe supports install hooks again on AEM cloud. The current solution makes it very difficult to run actions at a deployment.