Generally the Cron plugin will run if there's still execution time for
1 second since starting the Action processing. If you want to change
this (such as disabling, 0 seconds, or maybe running bigger chunks,
for like 4 seconds) you can do this, where 'n' is time in seconds.
addPlugin('Cron', array('secs_per_action', n));
Add 'rel_to_pageload'=>false to the array if you want to run the queue
for a certain amount of seconds _despite_ maybe already having run that
long in the previous parts of Action processing.
Perhaps you want to run the cron script remotely, using a machine capable
of background processing (or locally, to avoid running daemon processes),
simply do an HTTP GET request to the route /main/cron of your GNU social.
Setting secs_per_action to 0 in the plugin config will imply that you run
all your queue handling by calling /main/cron (which runs as long as it can).
/main/cron will output "0" if it has finished processing, "1" if it should
be called again to complete processing (because it ran out of time due to
PHP's max_execution_time INI setting).
The Cron plugin also runs events as close to hourly, daily and weekly
as you get, based on the opportunistic method of running whenever a user
visits the site. This means of course that the cron events should be as
fast as possible, not only to avoid delaying page load for users but
also to minimize the risk of running into PHP's max_execution_time. One
suggestion is to only use the events to add new queue items for later processing.
These events are called CronHourly, CronDaily, CronWeekly - however there
is no guarantee that all events will execute, so some kind of failsafe,
transaction-ish method must be implemented in the future.
EndEndHTML: just after the </html> tag
- $action: action object being shown
+FinalAction: After prepare() (and possible handle) in Action class.
+- $status: result of "prepare" call on action
+- $action: Action that is currently running
+
StartShowDesign: just before showing a site, user, or group design
- $action: action object being shown
common_config_set('db', 'database', $mirror);
}
- if ($this->prepare($args)) {
+ $status = $this->prepare($args);
+ if ($status) {
$this->handle($args);
+ } else {
+ common_debug('Prepare failed for Action.');
}
+
+ $this->flush();
+
+ Event::handle('EndActionExecute', array($status, $this));
}
/**
'plugins' =>
array('core' => array(
'AuthCrypt' => array(),
+ 'Cron' => array(),
'LRDD' => array(),
'StrictTransportSecurity' => array(),
),
self::$qm = new UnQueueManager();
} else {
switch ($type) {
+ case 'cron':
+ self::$qm = new CronQueueManager();
+ break;
case 'db':
self::$qm = new DBQueueManager();
break;
$daemons = array();
-$daemons[] = INSTALLDIR.'/scripts/queuedaemon.php';
+#$daemons[] = INSTALLDIR.'/scripts/queuedaemon.php';
if (Event::handle('GetValidDaemons', array(&$daemons))) {
foreach ($daemons as $daemon) {