0cd93c2761
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.
48 lines
1.5 KiB
PHP
Executable File
48 lines
1.5 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
/*
|
|
* StatusNet - the distributed open-source microblogging tool
|
|
* Copyright (C) 2008, 2009, StatusNet, Inc.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/**
|
|
* Utility script to get a list of daemons that should run, based on the
|
|
* current configuration. This is used by startdaemons.sh to determine what
|
|
* it should and shouldn't start up. The output is a list of space-separated
|
|
* daemon names.
|
|
*/
|
|
|
|
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
|
|
|
|
$helptext = <<<ENDOFHELP
|
|
getvaliddaemons.php - print out a list of valid daemons that should be started
|
|
by the startdaemons script
|
|
|
|
ENDOFHELP;
|
|
|
|
require_once INSTALLDIR.'/scripts/commandline.inc';
|
|
|
|
$daemons = array();
|
|
|
|
#$daemons[] = INSTALLDIR.'/scripts/queuedaemon.php';
|
|
|
|
if (Event::handle('GetValidDaemons', array(&$daemons))) {
|
|
foreach ($daemons as $daemon) {
|
|
print $daemon . ' ';
|
|
}
|
|
print "\n";
|
|
}
|