silverstripe-crontask icon indicating copy to clipboard operation
silverstripe-crontask copied to clipboard

Example with Sera + rationale

Open phptek opened this issue 8 years ago • 3 comments

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 custom CronTask 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 )

phptek avatar Aug 03 '16 21:08 phptek

Would you like to PR a fix to the documentation please?

tractorcow avatar Aug 12 '16 01:08 tractorcow

@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".

phptek avatar Sep 08 '16 04:09 phptek

I'm also unfamiliar with sera, so your advice would be better than mine. :)

tractorcow avatar Nov 16 '16 00:11 tractorcow