websavers
Regular Pleskian
- Server operating system version
- AlmaLinux 8.10
- Plesk version and microupdate number
- 18.0.79 #5
When using events like `template_domain_update`, if the script the event calls also runs a command that triggers the very same event, it will continuously loop running the event, triggering the command, running the event, etc.
To avoid that, a lockfile can be created by the developer of the script, with something unique to the event (ex: the template id) that the event calls, then the lockfile would be checked at the start of each run. If found the lockfile must be removed, script exited.
The problem is I don't think Plesk devs would want to leave this up to script devs to realize and resolve.
At minimum, it would be useful to include info on this in the documentation - to watch out for loops and to ensure to use a lockfile if you must call a command that executes the same event.
At best, it would be better for Plesk's task manager to detect the loop and stop the duplicate from hitting the event.
Separate request:
It would also be handy to have an option for events to trigger their command only after the event has completed processing. With the service plan update events, this could be many minutes later.
To avoid that, a lockfile can be created by the developer of the script, with something unique to the event (ex: the template id) that the event calls, then the lockfile would be checked at the start of each run. If found the lockfile must be removed, script exited.
The problem is I don't think Plesk devs would want to leave this up to script devs to realize and resolve.
At minimum, it would be useful to include info on this in the documentation - to watch out for loops and to ensure to use a lockfile if you must call a command that executes the same event.
At best, it would be better for Plesk's task manager to detect the loop and stop the duplicate from hitting the event.
Separate request:
It would also be handy to have an option for events to trigger their command only after the event has completed processing. With the service plan update events, this could be many minutes later.