Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 5.4.0
-
Fix Version/s: 5.8.0-b1
-
Component/s: Staff Interface
-
Labels:None
Description
There are several automation tasks for which a 5 minute wait is problematic. As an example, "Unsuspend Services". A customer makes a payment to a late invoice, and their service is waiting for the cron to be unsuspended. Meanwhile they open an emergency ticket, only to have their service unsuspended seconds later. Everyone's time is wasted, and the customer is frustrated.
We set up the cron job to run every 5 minutes, and this is what we recommend. However, for some tasks we should allow them to be run every minute. This would involve at least 2 things:
1. Setting up the cron to run every minute, rather than every 5 minutes. We can recommend 5, but it must be set to 1 minute for intervals of 1 minute to work.
2. For specific tasks, allow an interval of 1 minute to be set.
Which tasks?
- Process Service Changes
- Process Service Renewals
- Provision Paid Pending Services
- Unsuspend Services
For these tasks, add a new interval of 1, prior to 5. 5 should remain the default.
If any tasks are set to 1 minute, and the cron has been running but not running every minute (Check last few runs), display an information/warning box on the top of the Settings > System > Automation page to say:
There are automation tasks set to run every minute, but your cron does not appear to be running every minute. Update your cron to run every minute to take advantage of these shorter intervals.
There may be something else that prevents any cron runs from happening more often than 5 minutes, if so that will need to be adjusted.
Cron can only run every 1 minute, but systemd Timers are a potential alternative that can run more frequently. See https://wiki.archlinux.org/title/Systemd/Timers
We should look into the feasibility of having some tasks run every 30 seconds (or 15 seconds at the most frequent) with the use of Timers instead of Cron. For some users, this could be incredibly effective. Blesta's automation system already attempts to prevent race conditions by not starting a task if it's still running, so we'd want to make sure that continues to work as expected.
Lets discuss this prior to implementation. If we added something like this then we'd not only add a 1 minute option to the tasks above, but a 15 or 30 second option and include instructions on creating a systemd Timer instead of a Cron job under the Settings > System > Automation section.