aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Addon.php1
-rw-r--r--Zotlabs/Daemon/Cache_embeds.php4
-rw-r--r--Zotlabs/Daemon/Cache_query.php4
-rw-r--r--Zotlabs/Daemon/Cli_suggest.php1
-rw-r--r--Zotlabs/Daemon/Convo.php31
-rw-r--r--Zotlabs/Daemon/Cron_daily.php2
-rw-r--r--Zotlabs/Daemon/Cron_weekly.php11
-rw-r--r--Zotlabs/Daemon/Deliver.php2
-rw-r--r--Zotlabs/Daemon/Deliver_hooks.php6
-rw-r--r--Zotlabs/Daemon/Directory.php2
-rw-r--r--Zotlabs/Daemon/Expire.php2
-rw-r--r--Zotlabs/Daemon/Importdoc.php2
-rw-r--r--Zotlabs/Daemon/Master.php1
-rw-r--r--Zotlabs/Daemon/Queue.php2
-rw-r--r--Zotlabs/Daemon/Thumbnail.php2
-rw-r--r--Zotlabs/Lib/QueueWorker.php26
16 files changed, 72 insertions, 27 deletions
diff --git a/Zotlabs/Daemon/Addon.php b/Zotlabs/Daemon/Addon.php
index c6778750d..126e11cf6 100644
--- a/Zotlabs/Daemon/Addon.php
+++ b/Zotlabs/Daemon/Addon.php
@@ -7,6 +7,7 @@ class Addon {
static public function run($argc, $argv) {
call_hooks('daemon_addon', $argv);
+ return;
}
diff --git a/Zotlabs/Daemon/Cache_embeds.php b/Zotlabs/Daemon/Cache_embeds.php
index 9e5b8d2bb..d5adfcc59 100644
--- a/Zotlabs/Daemon/Cache_embeds.php
+++ b/Zotlabs/Daemon/Cache_embeds.php
@@ -19,8 +19,10 @@ class Cache_embeds {
$item = $c[0];
// bbcode conversion by default processes embeds that aren't already cached.
- // Ignore the returned html output.
+ // Ignore the returned html output.
bbcode($item['body']);
+
+ return;
}
}
diff --git a/Zotlabs/Daemon/Cache_query.php b/Zotlabs/Daemon/Cache_query.php
index 5f92ae6d0..cd9597e9a 100644
--- a/Zotlabs/Daemon/Cache_query.php
+++ b/Zotlabs/Daemon/Cache_query.php
@@ -24,7 +24,7 @@ class Cache_query {
array_shift($argv);
array_shift($argv);
-
+
$arr = json_decode(base64_decode($argv[0]), true);
$r = call_user_func_array('q', $arr);
@@ -32,5 +32,7 @@ class Cache_query {
Cache::set($key, serialize($r));
del_config('procid', $key);
+
+ return;
}
}
diff --git a/Zotlabs/Daemon/Cli_suggest.php b/Zotlabs/Daemon/Cli_suggest.php
index 5dced462d..6306d2113 100644
--- a/Zotlabs/Daemon/Cli_suggest.php
+++ b/Zotlabs/Daemon/Cli_suggest.php
@@ -9,6 +9,7 @@ class Cli_suggest {
static public function run($argc,$argv) {
update_suggestions();
+ return:
}
}
diff --git a/Zotlabs/Daemon/Convo.php b/Zotlabs/Daemon/Convo.php
index 940216b2c..d1a7e4f4d 100644
--- a/Zotlabs/Daemon/Convo.php
+++ b/Zotlabs/Daemon/Convo.php
@@ -30,6 +30,7 @@ class Convo {
intval($channel_id),
dbesc($contact_hash)
);
+
if (!$r) {
return;
}
@@ -40,19 +41,25 @@ class Convo {
$messages = $obj->get();
- if ($messages) {
- foreach ($messages as $message) {
- if (is_string($message)) {
- $message = Activity::fetch($message, $channel);
- }
- // set client flag because comments will probably just be objects and not full blown activities
- // and that lets us use implied_create
- $AS = new ActivityStreams($message);
- if ($AS->is_valid() && is_array($AS->obj)) {
- $item = Activity::decode_note($AS);
- Activity::store($channel, $contact['abook_xchan'], $AS, $item);
- }
+ if (!$messages) {
+ return;
+ }
+
+ foreach ($messages as $message) {
+ if (is_string($message)) {
+ $message = Activity::fetch($message, $channel);
+ }
+
+ // set client flag because comments will probably just be objects and not full blown activities
+ // and that lets us use implied_create
+ $AS = new ActivityStreams($message);
+ if ($AS->is_valid() && is_array($AS->obj)) {
+ $item = Activity::decode_note($AS);
+ Activity::store($channel, $contact['abook_xchan'], $AS, $item);
}
}
+
+ return;
+
}
}
diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php
index 71d3bc9ef..6d62836c7 100644
--- a/Zotlabs/Daemon/Cron_daily.php
+++ b/Zotlabs/Daemon/Cron_daily.php
@@ -119,5 +119,7 @@ class Cron_daily {
/**
* End Cron Daily
*/
+
+ return;
}
}
diff --git a/Zotlabs/Daemon/Cron_weekly.php b/Zotlabs/Daemon/Cron_weekly.php
index 407aa40ef..75fb94700 100644
--- a/Zotlabs/Daemon/Cron_weekly.php
+++ b/Zotlabs/Daemon/Cron_weekly.php
@@ -22,12 +22,12 @@ class Cron_weekly {
mark_orphan_hubsxchans();
- // Find channels that were removed in the last three weeks, but
+ // Find channels that were removed in the last three weeks, but
// haven't been finally cleaned up. These should be older than 10
- // days to ensure that "purgeall" messages have gone out or bounced
- // or timed out.
+ // days to ensure that "purgeall" messages have gone out or bounced
+ // or timed out.
- $r = q("select channel_id from channel where channel_removed = 1 and
+ $r = q("select channel_id from channel where channel_removed = 1 and
channel_deleted > %s - INTERVAL %s and channel_deleted < %s - INTERVAL %s",
db_utcnow(), db_quoteinterval('21 DAY'),
db_utcnow(), db_quoteinterval('10 DAY')
@@ -59,5 +59,6 @@ class Cron_weekly {
* End Cron Weekly
*/
+ return;
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Daemon/Deliver.php b/Zotlabs/Daemon/Deliver.php
index 400ef697b..2d80dc093 100644
--- a/Zotlabs/Daemon/Deliver.php
+++ b/Zotlabs/Daemon/Deliver.php
@@ -28,6 +28,8 @@ class Deliver {
}
+ return;
+
}
}
diff --git a/Zotlabs/Daemon/Deliver_hooks.php b/Zotlabs/Daemon/Deliver_hooks.php
index 4d3ce4e1d..1e478db1e 100644
--- a/Zotlabs/Daemon/Deliver_hooks.php
+++ b/Zotlabs/Daemon/Deliver_hooks.php
@@ -12,8 +12,12 @@ class Deliver_hooks {
$r = q("select * from item where id = '%d'",
intval($argv[1])
);
- if ($r)
+
+ if ($r) {
call_hooks('notifier_normal', $r[0]);
+ }
+
+ return;
}
}
diff --git a/Zotlabs/Daemon/Directory.php b/Zotlabs/Daemon/Directory.php
index 3996b8079..19adf8273 100644
--- a/Zotlabs/Daemon/Directory.php
+++ b/Zotlabs/Daemon/Directory.php
@@ -97,5 +97,7 @@ class Directory {
if ($pushall) {
Master::Summon(array('Notifier', 'refresh_all', $channel['channel_id']));
}
+
+ return;
}
}
diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php
index 99fe68b6f..5d9f14b28 100644
--- a/Zotlabs/Daemon/Expire.php
+++ b/Zotlabs/Daemon/Expire.php
@@ -103,5 +103,7 @@ class Expire {
}
del_config('procid', 'expire');
+
+ return;
}
}
diff --git a/Zotlabs/Daemon/Importdoc.php b/Zotlabs/Daemon/Importdoc.php
index 9e818e2b3..c5a81e50c 100644
--- a/Zotlabs/Daemon/Importdoc.php
+++ b/Zotlabs/Daemon/Importdoc.php
@@ -11,6 +11,8 @@ class Importdoc {
self::update_docs_dir('doc/*');
+ return;
+
}
static public function update_docs_dir($s) {
diff --git a/Zotlabs/Daemon/Master.php b/Zotlabs/Daemon/Master.php
index 495718bf4..c9ed91aaa 100644
--- a/Zotlabs/Daemon/Master.php
+++ b/Zotlabs/Daemon/Master.php
@@ -11,6 +11,7 @@ if (array_search(__file__, get_included_files()) === 0) {
if ($argc)
Master::Release($argc, $argv);
+
return;
}
diff --git a/Zotlabs/Daemon/Queue.php b/Zotlabs/Daemon/Queue.php
index 41aaf45ed..3eb7d9d23 100644
--- a/Zotlabs/Daemon/Queue.php
+++ b/Zotlabs/Daemon/Queue.php
@@ -79,5 +79,7 @@ class Queue {
foreach ($r as $rv) {
LibQueue::deliver($rv);
}
+
+ return;
}
}
diff --git a/Zotlabs/Daemon/Thumbnail.php b/Zotlabs/Daemon/Thumbnail.php
index 3688e8ae5..fa9570658 100644
--- a/Zotlabs/Daemon/Thumbnail.php
+++ b/Zotlabs/Daemon/Thumbnail.php
@@ -73,5 +73,7 @@ class Thumbnail {
|| (filectime(dbunescbin($attach['content']) . 'thumb') < (time() - 60)))) {
$default_controller->Thumb($attach, $preview_style, $preview_width, $preview_height);
}
+
+ return;
}
}
diff --git a/Zotlabs/Lib/QueueWorker.php b/Zotlabs/Lib/QueueWorker.php
index 21983a4e2..48d5f5bb2 100644
--- a/Zotlabs/Lib/QueueWorker.php
+++ b/Zotlabs/Lib/QueueWorker.php
@@ -231,9 +231,6 @@ class QueueWorker {
}
public static function Process() {
- self::$workersleep = get_config('queueworker', 'queue_worker_sleep');
- self::$workersleep = intval(self::$workersleep) > 100 ? intval(self::$workersleep) : 100;
-
if (!self::GetWorkerID()) {
logger('Unable to get worker ID. Exiting.', LOGGER_DEBUG);
killme();
@@ -241,11 +238,26 @@ class QueueWorker {
$jobs = 0;
$workid = self::getWorkId();
+ $load_average_sleep = false;
+ self::$workersleep = get_config('queueworker', 'queue_worker_sleep');
+ self::$workersleep = ((intval(self::$workersleep) > 100) ? intval(self::$workersleep) : 100);
+
+ if (function_exists('sys_getloadavg') && get_config('queueworker', 'load_average_sleep')) {
+ $load_average_sleep = true;
+ }
+
while ($workid) {
+
+ if ($load_average_sleep) {
+ $load_average = sys_getloadavg();
+ self::$workersleep = intval($load_average[0]) * 100000;
+
+ if (!self::$workersleep) {
+ self::$workersleep = 100;
+ }
+ }
+
usleep(self::$workersleep);
- // @FIXME: Currently $workersleep is a fixed value. It may be a good idea
- // to implement a "backoff" instead - based on load average or some
- // other metric.
self::qbegin('workerq');
@@ -276,7 +288,7 @@ class QueueWorker {
$workinfo = json_decode($workitem[0]['workerq_data'], true);
$argv = $workinfo['argv'];
- logger('Master: process: ' . json_encode($argv), LOGGER_DEBUG);
+ hz_syslog('Master: process: ' . json_encode($argv), LOGGER_DEBUG);
$cls = '\\Zotlabs\\Daemon\\' . $argv[0];
$argv = flatten_array_recursive($argv);