silverstripe-crontask
silverstripe-crontask copied to clipboard
Example with Sera + rationale
In the README there is the following statement:
Warning: Observe that the crontask module doesn't to any scheduling. If the run time is more than one minute, it might start another process that interferes with the still running process.
It would be great to pad this out a bit with a rationale and an example using Sera. E.g.
Warning: Ensure that a custom
CronTask
doesn't do any scheduling of its own. If a customCronTask
itself forks other sub tasks or is itself long running (i.e. > 1m), the server's cron-job might start another process that interferes with any existing and running processes. This can be mitigated by running the module's cron-job less frequently or proxying the module's cron-jobs through the "Sera" module, which implements a form of DML (Distributed Mutex Locking) e.g.
* * * * * sera 60 $( www-data /usr/bin/php /path/to/silverstripe/docroot/framework/cli-script.php dev/cron )
Would you like to PR a fix to the documentation please?
@tractorcow I ask because I've never used sera and before I did, wanted to understand how it worked. If the text I wrote above fits the bill and is accurate, I'd be more than happy to submit a PR for it, "as-is".
I'm also unfamiliar with sera, so your advice would be better than mine. :)