mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:35:13 +00:00
Provide infrastructure for porting queueworker addon and fix some nasty queueworker bugs
This commit is contained in:
parent
0922aacf45
commit
1c3c9ceeb9
3 changed files with 42 additions and 42 deletions
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
/* This file will be left here for a period of six months
|
||||
* starting 2020-06-15. Then it will be removed.
|
||||
* The English word 'master' is being removed from the codebase.
|
||||
* This file was previously referenced in setup scripts and is
|
||||
* required to run background tasks. It is executed by cron.
|
||||
* We don't want to break this on the short term. This is your
|
||||
* first warning. The file will be removed in six months and
|
||||
* you will need to point your cron job or scheduled task to
|
||||
* Zotlabs/Daemon/Run.php instead of Zotlabs/Daemon/Master.php.
|
||||
*
|
||||
*/
|
||||
|
||||
if(array_search( __file__ , get_included_files()) === 0) {
|
||||
|
||||
require_once('include/cli_startup.php');
|
||||
array_shift($argv);
|
||||
$argc = count($argv);
|
||||
|
||||
if($argc)
|
||||
Master::Release($argc,$argv);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Master {
|
||||
|
||||
static public function Summon($arr) {
|
||||
proc_run('php','Zotlabs/Daemon/Master.php',$arr);
|
||||
}
|
||||
|
||||
static public function Release($argc,$argv) {
|
||||
cli_startup();
|
||||
logger('Master: release: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG);
|
||||
$cls = '\\Zotlabs\\Daemon\\' . $argv[0];
|
||||
$cls::run($argc,$argv);
|
||||
}
|
||||
}
|
|
@ -18,15 +18,56 @@ if (array_search( __file__ , get_included_files()) === 0) {
|
|||
|
||||
class Run {
|
||||
|
||||
// These processes should be ignored by addons which enforce timeouts (e.g. queueworker)
|
||||
// as it could result in corrupt data. Please add additional long running tasks to this list as they arise.
|
||||
// Ideally the queueworker should probably be provided an allow list rather than a deny list as it will be easier
|
||||
// to maintain. This was a quick hack to fix truncation of very large synced files when the queueworker addon is installed.
|
||||
|
||||
public static $long_running = [ 'Addon', 'Channel_purge', 'Checksites', 'Content_importer', 'Convo',
|
||||
'Cron', 'Cron_daily', 'Cron_weekly', 'Delxitems', 'Expire', 'File_importer', 'Importfile'
|
||||
];
|
||||
|
||||
static public function Summon($arr) {
|
||||
if (file_exists('maintenance_lock') || file_exists('cache/maintenance_lock')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$hookinfo = [
|
||||
'argv' => $arr,
|
||||
'long_running' => self::$long_running
|
||||
];
|
||||
|
||||
call_hooks('daemon_summon', $hookinfo);
|
||||
|
||||
$arr = $hookinfo['argv'];
|
||||
$argc = count($arr);
|
||||
|
||||
if ((! is_array($arr) || ($argc < 1))) {
|
||||
logger("Summon handled by hook.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
proc_run('php','Zotlabs/Daemon/Run.php',$arr);
|
||||
}
|
||||
|
||||
static public function Release($argc,$argv) {
|
||||
cli_startup();
|
||||
|
||||
$hookinfo = [
|
||||
'argv' => $argv,
|
||||
'long_running' => self::$long_running
|
||||
];
|
||||
|
||||
call_hooks('daemon_release', $hookinfo);
|
||||
|
||||
$argv = $hookinfo['argv'];
|
||||
$argc = count($argv);
|
||||
|
||||
if ((! is_array($argv) || ($argc < 1))) {
|
||||
logger("Release handled by hook.", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
logger('Run: release: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG);
|
||||
$cls = '\\Zotlabs\\Daemon\\' . $argv[0];
|
||||
$cls::run($argc,$argv);
|
||||
|
|
2
boot.php
2
boot.php
|
@ -16,7 +16,7 @@ use Zotlabs\Daemon\Run;
|
|||
* @brief This file defines some global constants and includes the central App class.
|
||||
*/
|
||||
|
||||
define ( 'STD_VERSION', '21.01.25' );
|
||||
define ( 'STD_VERSION', '21.01.28' );
|
||||
define ( 'ZOT_REVISION', '6.0' );
|
||||
|
||||
define ( 'DB_UPDATE_VERSION', 1247 );
|
||||
|
|
Loading…
Reference in a new issue