mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:00:16 +00:00
The priority is now a class constant
This commit is contained in:
parent
b33b70f0ab
commit
018858934b
46 changed files with 148 additions and 151 deletions
15
boot.php
15
boot.php
|
@ -71,21 +71,6 @@ define('GRAVITY_COMMENT', 6);
|
||||||
define('GRAVITY_UNKNOWN', 9);
|
define('GRAVITY_UNKNOWN', 9);
|
||||||
/* @}*/
|
/* @}*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Priority
|
|
||||||
*
|
|
||||||
* Process priority for the worker
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
define('PRIORITY_UNDEFINED', 0);
|
|
||||||
define('PRIORITY_CRITICAL', 10);
|
|
||||||
define('PRIORITY_HIGH', 20);
|
|
||||||
define('PRIORITY_MEDIUM', 30);
|
|
||||||
define('PRIORITY_LOW', 40);
|
|
||||||
define('PRIORITY_NEGLIGIBLE', 50);
|
|
||||||
define('PRIORITIES', [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE]);
|
|
||||||
/* @}*/
|
|
||||||
|
|
||||||
// Normally this constant is defined - but not if "pcntl" isn't installed
|
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||||
if (!defined('SIGTERM')) {
|
if (!defined('SIGTERM')) {
|
||||||
define('SIGTERM', 15);
|
define('SIGTERM', 15);
|
||||||
|
|
|
@ -205,7 +205,7 @@ function events_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$cid && $uri_id) {
|
if (!$cid && $uri_id) {
|
||||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$uri_id, (int)$uid);
|
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$uri_id, (int)$uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::baseUrl()->redirect('events');
|
DI::baseUrl()->redirect('events');
|
||||||
|
|
|
@ -36,6 +36,7 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Session;
|
use Friendica\Core\Session;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Attach;
|
use Friendica\Model\Attach;
|
||||||
|
@ -635,7 +636,7 @@ function item_post(App $a) {
|
||||||
unset($datarray['self']);
|
unset($datarray['self']);
|
||||||
unset($datarray['api_source']);
|
unset($datarray['api_source']);
|
||||||
|
|
||||||
Post\Delayed::add($datarray['uri'], $datarray, PRIORITY_HIGH, Post\Delayed::PREPARED_NO_HOOK, $scheduled_at);
|
Post\Delayed::add($datarray['uri'], $datarray, Worker::PRIORITY_HIGH, Post\Delayed::PREPARED_NO_HOOK, $scheduled_at);
|
||||||
item_post_return(DI::baseUrl(), $api_source, $return_path);
|
item_post_return(DI::baseUrl(), $api_source, $return_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,6 @@ EOT;
|
||||||
|
|
||||||
$post = Post::selectFirst(['uri-id', 'uid'], ['id' => $post_id]);
|
$post = Post::selectFirst(['uri-id', 'uid'], ['id' => $post_id]);
|
||||||
|
|
||||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $post['uri-id'], $post['uid']);
|
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, $post['uri-id'], $post['uid']);
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ HELP;
|
||||||
$this->out('Schedule relocation messages to remote Friendica and Diaspora hosts');
|
$this->out('Schedule relocation messages to remote Friendica and Diaspora hosts');
|
||||||
$users = $this->database->selectToArray('user', ['uid'], ['account_removed' => false, 'account_expired' => false]);
|
$users = $this->database->selectToArray('user', ['uid'], ['account_removed' => false, 'account_expired' => false]);
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']);
|
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $user['uid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -192,7 +192,7 @@ class Search
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add found profiles from the global directory to the local directory
|
// Add found profiles from the global directory to the local directory
|
||||||
Worker::add(PRIORITY_LOW, 'SearchDirectory', $search);
|
Worker::add(Worker::PRIORITY_LOW, 'SearchDirectory', $search);
|
||||||
|
|
||||||
return $resultList;
|
return $resultList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Update
|
||||||
*/
|
*/
|
||||||
self::run($basePath);
|
self::run($basePath);
|
||||||
} else {
|
} else {
|
||||||
Worker::add(PRIORITY_CRITICAL, 'DBUpdate');
|
Worker::add(Worker::PRIORITY_CRITICAL, 'DBUpdate');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,7 +322,7 @@ class UserImport
|
||||||
}
|
}
|
||||||
|
|
||||||
// send relocate messages
|
// send relocate messages
|
||||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid);
|
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid);
|
||||||
|
|
||||||
info(DI::l10n()->t("Done. You can now login with your username and password"));
|
info(DI::l10n()->t("Done. You can now login with your username and password"));
|
||||||
DI::baseUrl()->redirect('login');
|
DI::baseUrl()->redirect('login');
|
||||||
|
|
|
@ -31,12 +31,20 @@ use Friendica\Util\DateTimeFormat;
|
||||||
*/
|
*/
|
||||||
class Worker
|
class Worker
|
||||||
{
|
{
|
||||||
const PRIORITY_UNDEFINED = PRIORITY_UNDEFINED;
|
/**
|
||||||
const PRIORITY_CRITICAL = PRIORITY_CRITICAL;
|
* @name Priority
|
||||||
const PRIORITY_HIGH = PRIORITY_HIGH;
|
*
|
||||||
const PRIORITY_MEDIUM = PRIORITY_MEDIUM;
|
* Process priority for the worker
|
||||||
const PRIORITY_LOW = PRIORITY_LOW;
|
* @{
|
||||||
const PRIORITY_NEGLIGIBLE = PRIORITY_NEGLIGIBLE;
|
*/
|
||||||
|
const PRIORITY_UNDEFINED = 0;
|
||||||
|
const PRIORITY_CRITICAL = 10;
|
||||||
|
const PRIORITY_HIGH = 20;
|
||||||
|
const PRIORITY_MEDIUM = 30;
|
||||||
|
const PRIORITY_LOW = 40;
|
||||||
|
const PRIORITY_NEGLIGIBLE = 50;
|
||||||
|
const PRIORITIES = [self::PRIORITY_CRITICAL, self::PRIORITY_HIGH, self::PRIORITY_MEDIUM, self::PRIORITY_LOW, self::PRIORITY_NEGLIGIBLE];
|
||||||
|
/* @}*/
|
||||||
|
|
||||||
const STATE_STARTUP = 1; // Worker is in startup. This takes most time.
|
const STATE_STARTUP = 1; // Worker is in startup. This takes most time.
|
||||||
const STATE_LONG_LOOP = 2; // Worker is processing the whole - long - loop.
|
const STATE_LONG_LOOP = 2; // Worker is processing the whole - long - loop.
|
||||||
|
@ -807,7 +815,7 @@ class Worker
|
||||||
$top_priority = self::highestPriority();
|
$top_priority = self::highestPriority();
|
||||||
$high_running = self::processWithPriorityActive($top_priority);
|
$high_running = self::processWithPriorityActive($top_priority);
|
||||||
|
|
||||||
if (!$high_running && ($top_priority > PRIORITY_UNDEFINED) && ($top_priority < PRIORITY_NEGLIGIBLE)) {
|
if (!$high_running && ($top_priority > self::PRIORITY_UNDEFINED) && ($top_priority < self::PRIORITY_NEGLIGIBLE)) {
|
||||||
Logger::info('Jobs with a higher priority are waiting but none is executed. Open a fastlane.', ['priority' => $top_priority]);
|
Logger::info('Jobs with a higher priority are waiting but none is executed. Open a fastlane.', ['priority' => $top_priority]);
|
||||||
$queues = $active + 1;
|
$queues = $active + 1;
|
||||||
}
|
}
|
||||||
|
@ -939,7 +947,7 @@ class Worker
|
||||||
private static function nextPriority()
|
private static function nextPriority()
|
||||||
{
|
{
|
||||||
$waiting = [];
|
$waiting = [];
|
||||||
$priorities = [PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE];
|
$priorities = [self::PRIORITY_CRITICAL, self::PRIORITY_HIGH, self::PRIORITY_MEDIUM, self::PRIORITY_LOW, self::PRIORITY_NEGLIGIBLE];
|
||||||
foreach ($priorities as $priority) {
|
foreach ($priorities as $priority) {
|
||||||
$stamp = (float)microtime(true);
|
$stamp = (float)microtime(true);
|
||||||
if (DBA::exists('workerqueue', ["`priority` = ? AND `pid` = 0 AND NOT `done` AND `next_try` < ?", $priority, DateTimeFormat::utcNow()])) {
|
if (DBA::exists('workerqueue', ["`priority` = ? AND `pid` = 0 AND NOT `done` AND `next_try` < ?", $priority, DateTimeFormat::utcNow()])) {
|
||||||
|
@ -948,8 +956,8 @@ class Worker
|
||||||
self::$db_duration += (microtime(true) - $stamp);
|
self::$db_duration += (microtime(true) - $stamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($waiting[PRIORITY_CRITICAL])) {
|
if (!empty($waiting[self::PRIORITY_CRITICAL])) {
|
||||||
return PRIORITY_CRITICAL;
|
return self::PRIORITY_CRITICAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$running = [];
|
$running = [];
|
||||||
|
@ -1206,8 +1214,8 @@ class Worker
|
||||||
* @param (integer|array) priority or parameter array, strings are deprecated and are ignored
|
* @param (integer|array) priority or parameter array, strings are deprecated and are ignored
|
||||||
*
|
*
|
||||||
* next args are passed as $cmd command line
|
* next args are passed as $cmd command line
|
||||||
* or: Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::DELETION, $drop_id);
|
* or: Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::DELETION, $drop_id);
|
||||||
* or: Worker::add(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), 'Delivery', $post_id);
|
* or: Worker::add(array('priority' => Worker::PRIORITY_HIGH, 'dont_fork' => true), 'Delivery', $post_id);
|
||||||
*
|
*
|
||||||
* @return int '0' if worker queue entry already existed or there had been an error, otherwise the ID of the worker task
|
* @return int '0' if worker queue entry already existed or there had been an error, otherwise the ID of the worker task
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
|
@ -1230,7 +1238,7 @@ class Worker
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$priority = PRIORITY_MEDIUM;
|
$priority = self::PRIORITY_MEDIUM;
|
||||||
// Don't fork from frontend tasks by default
|
// Don't fork from frontend tasks by default
|
||||||
$dont_fork = DI::config()->get('system', 'worker_dont_fork', false) || !DI::mode()->isBackend();
|
$dont_fork = DI::config()->get('system', 'worker_dont_fork', false) || !DI::mode()->isBackend();
|
||||||
$created = DateTimeFormat::utcNow();
|
$created = DateTimeFormat::utcNow();
|
||||||
|
@ -1266,9 +1274,9 @@ class Worker
|
||||||
$found = DBA::exists('workerqueue', ['command' => $command, 'parameter' => $parameters, 'done' => false]);
|
$found = DBA::exists('workerqueue', ['command' => $command, 'parameter' => $parameters, 'done' => false]);
|
||||||
$added = 0;
|
$added = 0;
|
||||||
|
|
||||||
if (!is_int($priority) || !in_array($priority, PRIORITIES)) {
|
if (!is_int($priority) || !in_array($priority, self::PRIORITIES)) {
|
||||||
Logger::warning('Invalid priority', ['priority' => $priority, 'command' => $command, 'callstack' => System::callstack(20)]);
|
Logger::warning('Invalid priority', ['priority' => $priority, 'command' => $command, 'callstack' => System::callstack(20)]);
|
||||||
$priority = PRIORITY_MEDIUM;
|
$priority = self::PRIORITY_MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit if there was a database error - a precaution for the update process to 3.5.3
|
// Quit if there was a database error - a precaution for the update process to 3.5.3
|
||||||
|
@ -1383,12 +1391,12 @@ class Worker
|
||||||
$delay = (($new_retrial + 2) ** 4) + (rand(1, 30) * ($new_retrial));
|
$delay = (($new_retrial + 2) ** 4) + (rand(1, 30) * ($new_retrial));
|
||||||
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
|
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
|
||||||
|
|
||||||
if (($priority < PRIORITY_MEDIUM) && ($new_retrial > 3)) {
|
if (($priority < self::PRIORITY_MEDIUM) && ($new_retrial > 3)) {
|
||||||
$priority = PRIORITY_MEDIUM;
|
$priority = self::PRIORITY_MEDIUM;
|
||||||
} elseif (($priority < PRIORITY_LOW) && ($new_retrial > 6)) {
|
} elseif (($priority < self::PRIORITY_LOW) && ($new_retrial > 6)) {
|
||||||
$priority = PRIORITY_LOW;
|
$priority = self::PRIORITY_LOW;
|
||||||
} elseif (($priority < PRIORITY_NEGLIGIBLE) && ($new_retrial > 8)) {
|
} elseif (($priority < self::PRIORITY_NEGLIGIBLE) && ($new_retrial > 8)) {
|
||||||
$priority = PRIORITY_NEGLIGIBLE;
|
$priority = self::PRIORITY_NEGLIGIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info('Deferred task', ['id' => $id, 'retrial' => $new_retrial, 'created' => $queue['created'], 'next_execution' => $next, 'old_prio' => $queue['priority'], 'new_prio' => $priority]);
|
Logger::info('Deferred task', ['id' => $id, 'retrial' => $new_retrial, 'created' => $queue['created'], 'next_execution' => $next, 'old_prio' => $queue['priority'], 'new_prio' => $priority]);
|
||||||
|
|
|
@ -47,10 +47,10 @@ class Cron
|
||||||
Logger::info('Add cron entries');
|
Logger::info('Add cron entries');
|
||||||
|
|
||||||
// Check for spooled items
|
// Check for spooled items
|
||||||
Worker::add(['priority' => PRIORITY_HIGH, 'force_priority' => true], 'SpoolPost');
|
Worker::add(['priority' => Worker::PRIORITY_HIGH, 'force_priority' => true], 'SpoolPost');
|
||||||
|
|
||||||
// Run the cron job that calls all other jobs
|
// Run the cron job that calls all other jobs
|
||||||
Worker::add(['priority' => PRIORITY_MEDIUM, 'force_priority' => true], 'Cron');
|
Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'Cron');
|
||||||
|
|
||||||
// Cleaning dead processes
|
// Cleaning dead processes
|
||||||
self::killStaleWorkers();
|
self::killStaleWorkers();
|
||||||
|
@ -112,12 +112,12 @@ class Cron
|
||||||
// To avoid a blocking situation we reschedule the process at the beginning of the queue.
|
// To avoid a blocking situation we reschedule the process at the beginning of the queue.
|
||||||
// Additionally we are lowering the priority. (But not PRIORITY_CRITICAL)
|
// Additionally we are lowering the priority. (But not PRIORITY_CRITICAL)
|
||||||
$new_priority = $entry['priority'];
|
$new_priority = $entry['priority'];
|
||||||
if ($entry['priority'] == PRIORITY_HIGH) {
|
if ($entry['priority'] == Worker::PRIORITY_HIGH) {
|
||||||
$new_priority = PRIORITY_MEDIUM;
|
$new_priority = Worker::PRIORITY_MEDIUM;
|
||||||
} elseif ($entry['priority'] == PRIORITY_MEDIUM) {
|
} elseif ($entry['priority'] == Worker::PRIORITY_MEDIUM) {
|
||||||
$new_priority = PRIORITY_LOW;
|
$new_priority = Worker::PRIORITY_LOW;
|
||||||
} elseif ($entry['priority'] != PRIORITY_CRITICAL) {
|
} elseif ($entry['priority'] != Worker::PRIORITY_CRITICAL) {
|
||||||
$new_priority = PRIORITY_NEGLIGIBLE;
|
$new_priority = Worker::PRIORITY_NEGLIGIBLE;
|
||||||
}
|
}
|
||||||
DBA::update('workerqueue', ['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0], ['id' => $entry["id"]]
|
DBA::update('workerqueue', ['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0], ['id' => $entry["id"]]
|
||||||
);
|
);
|
||||||
|
@ -166,13 +166,13 @@ class Cron
|
||||||
Logger::info('Directly deliver inbox', ['inbox' => $delivery['inbox'], 'result' => $result['success']]);
|
Logger::info('Directly deliver inbox', ['inbox' => $delivery['inbox'], 'result' => $result['success']]);
|
||||||
continue;
|
continue;
|
||||||
} elseif ($delivery['failed'] < 3) {
|
} elseif ($delivery['failed'] < 3) {
|
||||||
$priority = PRIORITY_HIGH;
|
$priority = Worker::PRIORITY_HIGH;
|
||||||
} elseif ($delivery['failed'] < 6) {
|
} elseif ($delivery['failed'] < 6) {
|
||||||
$priority = PRIORITY_MEDIUM;
|
$priority = Worker::PRIORITY_MEDIUM;
|
||||||
} elseif ($delivery['failed'] < 8) {
|
} elseif ($delivery['failed'] < 8) {
|
||||||
$priority = PRIORITY_LOW;
|
$priority = Worker::PRIORITY_LOW;
|
||||||
} else {
|
} else {
|
||||||
$priority = PRIORITY_NEGLIGIBLE;
|
$priority = Worker::PRIORITY_NEGLIGIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($delivery['failed'] >= DI::config()->get('system', 'worker_defer_limit')) {
|
if ($delivery['failed'] >= DI::config()->get('system', 'worker_defer_limit')) {
|
||||||
|
|
|
@ -319,7 +319,7 @@ class Contact
|
||||||
|
|
||||||
// Update the contact in the background if needed
|
// Update the contact in the background if needed
|
||||||
if (Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
if (Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||||
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
Worker::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the internal fields
|
// Remove the internal fields
|
||||||
|
@ -884,7 +884,7 @@ class Contact
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete it in the background
|
// Delete it in the background
|
||||||
Worker::add(PRIORITY_MEDIUM, 'Contact\Remove', $id);
|
Worker::add(Worker::PRIORITY_MEDIUM, 'Contact\Remove', $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -908,7 +908,7 @@ class Contact
|
||||||
if (in_array($contact['rel'], [self::SHARING, self::FRIEND])) {
|
if (in_array($contact['rel'], [self::SHARING, self::FRIEND])) {
|
||||||
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
|
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
|
||||||
if (!empty($cdata['public'])) {
|
if (!empty($cdata['public'])) {
|
||||||
Worker::add(PRIORITY_HIGH, 'Contact\Unfollow', $cdata['public'], $contact['uid']);
|
Worker::add(Worker::PRIORITY_HIGH, 'Contact\Unfollow', $cdata['public'], $contact['uid']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -938,7 +938,7 @@ class Contact
|
||||||
if (in_array($contact['rel'], [self::FOLLOWER, self::FRIEND])) {
|
if (in_array($contact['rel'], [self::FOLLOWER, self::FRIEND])) {
|
||||||
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
|
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
|
||||||
if (!empty($cdata['public'])) {
|
if (!empty($cdata['public'])) {
|
||||||
Worker::add(PRIORITY_HIGH, 'Contact\RevokeFollow', $cdata['public'], $contact['uid']);
|
Worker::add(Worker::PRIORITY_HIGH, 'Contact\RevokeFollow', $cdata['public'], $contact['uid']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -966,11 +966,11 @@ class Contact
|
||||||
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
|
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
|
||||||
|
|
||||||
if (in_array($contact['rel'], [self::SHARING, self::FRIEND]) && !empty($cdata['public'])) {
|
if (in_array($contact['rel'], [self::SHARING, self::FRIEND]) && !empty($cdata['public'])) {
|
||||||
Worker::add(PRIORITY_HIGH, 'Contact\Unfollow', $cdata['public'], $contact['uid']);
|
Worker::add(Worker::PRIORITY_HIGH, 'Contact\Unfollow', $cdata['public'], $contact['uid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($contact['rel'], [self::FOLLOWER, self::FRIEND]) && !empty($cdata['public'])) {
|
if (in_array($contact['rel'], [self::FOLLOWER, self::FRIEND]) && !empty($cdata['public'])) {
|
||||||
Worker::add(PRIORITY_HIGH, 'Contact\RevokeFollow', $cdata['public'], $contact['uid']);
|
Worker::add(Worker::PRIORITY_HIGH, 'Contact\RevokeFollow', $cdata['public'], $contact['uid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::remove($contact['id']);
|
self::remove($contact['id']);
|
||||||
|
@ -1248,7 +1248,7 @@ class Contact
|
||||||
$contact_id = $contact['id'];
|
$contact_id = $contact['id'];
|
||||||
|
|
||||||
if (Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
if (Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||||
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
Worker::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($update) && (!empty($contact['uri-id']) || is_bool($update))) {
|
if (empty($update) && (!empty($contact['uri-id']) || is_bool($update))) {
|
||||||
|
@ -2365,7 +2365,7 @@ class Contact
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Logger::warning('account-user exists for a different contact id', ['account_user' => $account_user, 'id' => $id, 'uid' => $uid, 'uri-id' => $uri_id, 'url' => $url]);
|
Logger::warning('account-user exists for a different contact id', ['account_user' => $account_user, 'id' => $id, 'uid' => $uid, 'uri-id' => $uri_id, 'url' => $url]);
|
||||||
Worker::add(PRIORITY_HIGH, 'MergeContact', $account_user['id'], $id, $uid);
|
Worker::add(Worker::PRIORITY_HIGH, 'MergeContact', $account_user['id'], $id, $uid);
|
||||||
} elseif (DBA::insert('account-user', ['id' => $id, 'uri-id' => $uri_id, 'uid' => $uid], Database::INSERT_IGNORE)) {
|
} elseif (DBA::insert('account-user', ['id' => $id, 'uri-id' => $uri_id, 'uid' => $uid], Database::INSERT_IGNORE)) {
|
||||||
Logger::notice('account-user was added', ['id' => $id, 'uid' => $uid, 'uri-id' => $uri_id, 'url' => $url]);
|
Logger::notice('account-user was added', ['id' => $id, 'uid' => $uid, 'uri-id' => $uri_id, 'url' => $url]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2406,7 +2406,7 @@ class Contact
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Worker::add(PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid);
|
Worker::add(Worker::PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid);
|
||||||
}
|
}
|
||||||
DBA::close($duplicates);
|
DBA::close($duplicates);
|
||||||
Logger::info('Duplicates handled', ['uid' => $uid, 'nurl' => $nurl, 'callstack' => System::callstack(20)]);
|
Logger::info('Duplicates handled', ['uid' => $uid, 'nurl' => $nurl, 'callstack' => System::callstack(20)]);
|
||||||
|
@ -2608,7 +2608,7 @@ class Contact
|
||||||
if ($ret['network'] == Protocol::ACTIVITYPUB) {
|
if ($ret['network'] == Protocol::ACTIVITYPUB) {
|
||||||
$apcontact = APContact::getByURL($ret['url'], false);
|
$apcontact = APContact::getByURL($ret['url'], false);
|
||||||
if (!empty($apcontact['featured'])) {
|
if (!empty($apcontact['featured'])) {
|
||||||
Worker::add(PRIORITY_LOW, 'FetchFeaturedPosts', $ret['url']);
|
Worker::add(Worker::PRIORITY_LOW, 'FetchFeaturedPosts', $ret['url']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2649,7 +2649,7 @@ class Contact
|
||||||
self::updateContact($id, $uid, $uriid, $contact['url'], ['failed' => false, 'local-data' => $has_local_data, 'last-update' => $updated, 'next-update' => $success_next_update, 'success_update' => $updated]);
|
self::updateContact($id, $uid, $uriid, $contact['url'], ['failed' => false, 'local-data' => $has_local_data, 'last-update' => $updated, 'next-update' => $success_next_update, 'success_update' => $updated]);
|
||||||
|
|
||||||
if (Contact\Relation::isDiscoverable($ret['url'])) {
|
if (Contact\Relation::isDiscoverable($ret['url'])) {
|
||||||
Worker::add(PRIORITY_LOW, 'ContactDiscovery', $ret['url']);
|
Worker::add(Worker::PRIORITY_LOW, 'ContactDiscovery', $ret['url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the public contact
|
// Update the public contact
|
||||||
|
@ -2693,7 +2693,7 @@ class Contact
|
||||||
self::updateContact($id, $uid, $ret['uri-id'], $ret['url'], $ret);
|
self::updateContact($id, $uid, $ret['uri-id'], $ret['url'], $ret);
|
||||||
|
|
||||||
if (Contact\Relation::isDiscoverable($ret['url'])) {
|
if (Contact\Relation::isDiscoverable($ret['url'])) {
|
||||||
Worker::add(PRIORITY_LOW, 'ContactDiscovery', $ret['url']);
|
Worker::add(Worker::PRIORITY_LOW, 'ContactDiscovery', $ret['url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2949,13 +2949,13 @@ class Contact
|
||||||
|
|
||||||
// pull feed and consume it, which should subscribe to the hub.
|
// pull feed and consume it, which should subscribe to the hub.
|
||||||
if ($contact['network'] == Protocol::OSTATUS) {
|
if ($contact['network'] == Protocol::OSTATUS) {
|
||||||
Worker::add(PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($probed) {
|
if ($probed) {
|
||||||
self::updateFromProbeArray($contact_id, $ret);
|
self::updateFromProbeArray($contact_id, $ret);
|
||||||
} else {
|
} else {
|
||||||
Worker::add(PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
Worker::add(Worker::PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result['success'] = Protocol::follow($uid, $contact, $protocol);
|
$result['success'] = Protocol::follow($uid, $contact, $protocol);
|
||||||
|
@ -3407,10 +3407,10 @@ class Contact
|
||||||
}
|
}
|
||||||
$contact = self::getByURL($url, false, ['id', 'network', 'next-update']);
|
$contact = self::getByURL($url, false, ['id', 'network', 'next-update']);
|
||||||
if (empty($contact['id']) && Network::isValidHttpUrl($url)) {
|
if (empty($contact['id']) && Network::isValidHttpUrl($url)) {
|
||||||
Worker::add(PRIORITY_LOW, 'AddContact', 0, $url);
|
Worker::add(Worker::PRIORITY_LOW, 'AddContact', 0, $url);
|
||||||
++$added;
|
++$added;
|
||||||
} elseif (!empty($contact['network']) && Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
} elseif (!empty($contact['network']) && Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||||
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
Worker::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], 'UpdateContact', $contact['id']);
|
||||||
++$updated;
|
++$updated;
|
||||||
} else {
|
} else {
|
||||||
++$unchanged;
|
++$unchanged;
|
||||||
|
|
|
@ -58,7 +58,7 @@ class FContact
|
||||||
$update = empty($person['guid']) || empty($person['uri-id']) || ($person['created'] <= DBA::NULL_DATETIME);
|
$update = empty($person['guid']) || empty($person['uri-id']) || ($person['created'] <= DBA::NULL_DATETIME);
|
||||||
if (GServer::getNextUpdateDate(true, $person['created'], $person['updated'], false) < DateTimeFormat::utcNow()) {
|
if (GServer::getNextUpdateDate(true, $person['created'], $person['updated'], false) < DateTimeFormat::utcNow()) {
|
||||||
Logger::debug('Start background update', ['handle' => $handle]);
|
Logger::debug('Start background update', ['handle' => $handle]);
|
||||||
Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], 'UpdateFContact', $handle);
|
Worker::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], 'UpdateFContact', $handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (is_null($update)) {
|
} elseif (is_null($update)) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ class GServer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'UpdateGServer', $url, $only_nodeinfo);
|
Worker::add(Worker::PRIORITY_LOW, 'UpdateGServer', $url, $only_nodeinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2108,10 +2108,10 @@ class GServer
|
||||||
|
|
||||||
while ($gserver = DBA::fetch($gservers)) {
|
while ($gserver = DBA::fetch($gservers)) {
|
||||||
Logger::info('Update peer list', ['server' => $gserver['url'], 'id' => $gserver['id']]);
|
Logger::info('Update peer list', ['server' => $gserver['url'], 'id' => $gserver['id']]);
|
||||||
Worker::add(PRIORITY_LOW, 'UpdateServerPeers', $gserver['url']);
|
Worker::add(Worker::PRIORITY_LOW, 'UpdateServerPeers', $gserver['url']);
|
||||||
|
|
||||||
Logger::info('Update directory', ['server' => $gserver['url'], 'id' => $gserver['id']]);
|
Logger::info('Update directory', ['server' => $gserver['url'], 'id' => $gserver['id']]);
|
||||||
Worker::add(PRIORITY_LOW, 'UpdateServerDirectory', $gserver);
|
Worker::add(Worker::PRIORITY_LOW, 'UpdateServerDirectory', $gserver);
|
||||||
|
|
||||||
$fields = ['last_poco_query' => DateTimeFormat::utcNow()];
|
$fields = ['last_poco_query' => DateTimeFormat::utcNow()];
|
||||||
self::update($fields, ['nurl' => $gserver['nurl']]);
|
self::update($fields, ['nurl' => $gserver['nurl']]);
|
||||||
|
|
|
@ -232,7 +232,7 @@ class Item
|
||||||
|
|
||||||
foreach ($notify_items as $notify_item) {
|
foreach ($notify_items as $notify_item) {
|
||||||
$post = Post::selectFirst(['uri-id', 'uid'], ['id' => $notify_item]);
|
$post = Post::selectFirst(['uri-id', 'uid'], ['id' => $notify_item]);
|
||||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::POST, (int)$post['uri-id'], (int)$post['uid']);
|
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::POST, (int)$post['uri-id'], (int)$post['uid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
|
@ -246,7 +246,7 @@ class Item
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function markForDeletion(array $condition, int $priority = PRIORITY_HIGH)
|
public static function markForDeletion(array $condition, int $priority = Worker::PRIORITY_HIGH)
|
||||||
{
|
{
|
||||||
$items = Post::select(['id'], $condition);
|
$items = Post::select(['id'], $condition);
|
||||||
while ($item = Post::fetch($items)) {
|
while ($item = Post::fetch($items)) {
|
||||||
|
@ -277,7 +277,7 @@ class Item
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item['uid'] == $uid) {
|
if ($item['uid'] == $uid) {
|
||||||
self::markForDeletionById($item['id'], PRIORITY_HIGH);
|
self::markForDeletionById($item['id'], Worker::PRIORITY_HIGH);
|
||||||
} elseif ($item['uid'] != 0) {
|
} elseif ($item['uid'] != 0) {
|
||||||
Logger::warning('Wrong ownership. Not deleting item', ['id' => $item['id']]);
|
Logger::warning('Wrong ownership. Not deleting item', ['id' => $item['id']]);
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ class Item
|
||||||
* @return boolean success
|
* @return boolean success
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function markForDeletionById(int $item_id, int $priority = PRIORITY_HIGH): bool
|
public static function markForDeletionById(int $item_id, int $priority = Worker::PRIORITY_HIGH): bool
|
||||||
{
|
{
|
||||||
Logger::info('Mark item for deletion by id', ['id' => $item_id, 'callstack' => System::callstack()]);
|
Logger::info('Mark item for deletion by id', ['id' => $item_id, 'callstack' => System::callstack()]);
|
||||||
// locate item to be deleted
|
// locate item to be deleted
|
||||||
|
@ -816,7 +816,7 @@ class Item
|
||||||
{
|
{
|
||||||
$orig_item = $item;
|
$orig_item = $item;
|
||||||
|
|
||||||
$priority = PRIORITY_HIGH;
|
$priority = Worker::PRIORITY_HIGH;
|
||||||
|
|
||||||
// If it is a posting where users should get notifications, then define it as wall posting
|
// If it is a posting where users should get notifications, then define it as wall posting
|
||||||
if ($notify) {
|
if ($notify) {
|
||||||
|
@ -826,7 +826,7 @@ class Item
|
||||||
$item['protocol'] = Conversation::PARCEL_DIRECT;
|
$item['protocol'] = Conversation::PARCEL_DIRECT;
|
||||||
$item['direction'] = Conversation::PUSH;
|
$item['direction'] = Conversation::PUSH;
|
||||||
|
|
||||||
if (is_int($notify) && in_array($notify, PRIORITIES)) {
|
if (is_int($notify) && in_array($notify, Worker::PRIORITIES)) {
|
||||||
$priority = $notify;
|
$priority = $notify;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -239,7 +239,7 @@ class Mail
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($post_id) {
|
if ($post_id) {
|
||||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::MAIL, $post_id);
|
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::MAIL, $post_id);
|
||||||
return intval($post_id);
|
return intval($post_id);
|
||||||
} else {
|
} else {
|
||||||
return -3;
|
return -3;
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Delayed
|
||||||
|
|
||||||
Logger::notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $uri]);
|
Logger::notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $uri]);
|
||||||
|
|
||||||
$wid = Worker::add(['priority' => PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments, $preparation_mode, $uri);
|
$wid = Worker::add(['priority' => Worker::PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments, $preparation_mode, $uri);
|
||||||
if (!$wid) {
|
if (!$wid) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,11 +153,11 @@ class Profile
|
||||||
if ($owner['net-publish'] || $force) {
|
if ($owner['net-publish'] || $force) {
|
||||||
// Update global directory in background
|
// Update global directory in background
|
||||||
if (Search::getGlobalDirectory()) {
|
if (Search::getGlobalDirectory()) {
|
||||||
Worker::add(PRIORITY_LOW, 'Directory', $owner['url']);
|
Worker::add(Worker::PRIORITY_LOW, 'Directory', $owner['url']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'ProfileUpdate', $uid);
|
Worker::add(Worker::PRIORITY_LOW, 'ProfileUpdate', $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,7 +37,7 @@ class PushSubscriber
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function publishFeed(int $uid, int $default_priority = PRIORITY_HIGH)
|
public static function publishFeed(int $uid, int $default_priority = Worker::PRIORITY_HIGH)
|
||||||
{
|
{
|
||||||
$condition = ['push' => 0, 'uid' => $uid];
|
$condition = ['push' => 0, 'uid' => $uid];
|
||||||
DBA::update('push_subscriber', ['push' => 1, 'next_try' => DBA::NULL_DATETIME], $condition);
|
DBA::update('push_subscriber', ['push' => 1, 'next_try' => DBA::NULL_DATETIME], $condition);
|
||||||
|
@ -52,7 +52,7 @@ class PushSubscriber
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function requeue(int $default_priority = PRIORITY_HIGH)
|
public static function requeue(int $default_priority = Worker::PRIORITY_HIGH)
|
||||||
{
|
{
|
||||||
// We'll push to each subscriber that has push > 0,
|
// We'll push to each subscriber that has push > 0,
|
||||||
// i.e. there has been an update (set in notifier.php).
|
// i.e. there has been an update (set in notifier.php).
|
||||||
|
@ -61,7 +61,7 @@ class PushSubscriber
|
||||||
while ($subscriber = DBA::fetch($subscribers)) {
|
while ($subscriber = DBA::fetch($subscribers)) {
|
||||||
// We always handle retries with low priority
|
// We always handle retries with low priority
|
||||||
if ($subscriber['push'] > 1) {
|
if ($subscriber['push'] > 1) {
|
||||||
$priority = PRIORITY_LOW;
|
$priority = Worker::PRIORITY_LOW;
|
||||||
} else {
|
} else {
|
||||||
$priority = $default_priority;
|
$priority = $default_priority;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ class Subscription
|
||||||
$subscriptions = DBA::select('subscription', [], ['uid' => $notification->uid, $type => true]);
|
$subscriptions = DBA::select('subscription', [], ['uid' => $notification->uid, $type => true]);
|
||||||
while ($subscription = DBA::fetch($subscriptions)) {
|
while ($subscription = DBA::fetch($subscriptions)) {
|
||||||
Logger::info('Push notification', ['id' => $subscription['id'], 'uid' => $subscription['uid'], 'type' => $type]);
|
Logger::info('Push notification', ['id' => $subscription['id'], 'uid' => $subscription['uid'], 'type' => $type]);
|
||||||
Worker::add(PRIORITY_HIGH, 'PushSubscription', $subscription['id'], $notification->id);
|
Worker::add(Worker::PRIORITY_HIGH, 'PushSubscription', $subscription['id'], $notification->id);
|
||||||
}
|
}
|
||||||
DBA::close($subscriptions);
|
DBA::close($subscriptions);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1317,7 +1317,7 @@ class User
|
||||||
|
|
||||||
if (DBA::isResult($profile) && $profile['net-publish'] && Search::getGlobalDirectory()) {
|
if (DBA::isResult($profile) && $profile['net-publish'] && Search::getGlobalDirectory()) {
|
||||||
$url = DI::baseUrl() . '/profile/' . $user['nickname'];
|
$url = DI::baseUrl() . '/profile/' . $user['nickname'];
|
||||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
Worker::add(Worker::PRIORITY_LOW, "Directory", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$l10n = DI::l10n()->withLang($register['language']);
|
$l10n = DI::l10n()->withLang($register['language']);
|
||||||
|
@ -1567,14 +1567,14 @@ class User
|
||||||
|
|
||||||
// The user and related data will be deleted in Friendica\Worker\ExpireAndRemoveUsers
|
// The user and related data will be deleted in Friendica\Worker\ExpireAndRemoveUsers
|
||||||
DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utc('now + 7 day')], ['uid' => $uid]);
|
DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utc('now + 7 day')], ['uid' => $uid]);
|
||||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::REMOVAL, $uid);
|
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::REMOVAL, $uid);
|
||||||
|
|
||||||
// Send an update to the directory
|
// Send an update to the directory
|
||||||
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||||
Worker::add(PRIORITY_LOW, 'Directory', $self['url']);
|
Worker::add(Worker::PRIORITY_LOW, 'Directory', $self['url']);
|
||||||
|
|
||||||
// Remove the user relevant data
|
// Remove the user relevant data
|
||||||
Worker::add(PRIORITY_NEGLIGIBLE, 'RemoveUser', $uid);
|
Worker::add(Worker::PRIORITY_NEGLIGIBLE, 'RemoveUser', $uid);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Contact extends BaseAdmin
|
||||||
|
|
||||||
if ($block_purge) {
|
if ($block_purge) {
|
||||||
foreach (Model\Contact::selectToArray(['id'], ['nurl' => $contact['nurl']]) as $contact) {
|
foreach (Model\Contact::selectToArray(['id'], ['nurl' => $contact['nurl']]) as $contact) {
|
||||||
Worker::add(PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
Worker::add(Worker::PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class Add extends BaseAdmin
|
||||||
if (!empty($request['purge'])) {
|
if (!empty($request['purge'])) {
|
||||||
$gservers = GServer::listByDomainPattern($pattern);
|
$gservers = GServer::listByDomainPattern($pattern);
|
||||||
foreach (Contact::selectToArray(['id'], ['gsid' => array_column($gservers, 'id')]) as $contact) {
|
foreach (Contact::selectToArray(['id'], ['gsid' => array_column($gservers, 'id')]) as $contact) {
|
||||||
Worker::add(PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
Worker::add(Worker::PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sysmsg->addInfo($this->l10n->tt('%s server scheduled to be purged.', '%s servers scheduled to be purged.', count($gservers)));
|
$this->sysmsg->addInfo($this->l10n->tt('%s server scheduled to be purged.', '%s servers scheduled to be purged.', count($gservers)));
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Site extends BaseAdmin
|
||||||
$a = DI::app();
|
$a = DI::app();
|
||||||
|
|
||||||
if (!empty($_POST['republish_directory'])) {
|
if (!empty($_POST['republish_directory'])) {
|
||||||
Worker::add(PRIORITY_LOW, 'Directory');
|
Worker::add(Worker::PRIORITY_LOW, 'Directory');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class Site extends BaseAdmin
|
||||||
// Has the directory url changed? If yes, then resubmit the existing profiles there
|
// Has the directory url changed? If yes, then resubmit the existing profiles there
|
||||||
if ($global_directory != DI::config()->get('system', 'directory') && ($global_directory != '')) {
|
if ($global_directory != DI::config()->get('system', 'directory') && ($global_directory != '')) {
|
||||||
DI::config()->set('system', 'directory', $global_directory);
|
DI::config()->set('system', 'directory', $global_directory);
|
||||||
Worker::add(PRIORITY_LOW, 'Directory');
|
Worker::add(Worker::PRIORITY_LOW, 'Directory');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DI::baseUrl()->getUrlPath() != "") {
|
if (DI::baseUrl()->getUrlPath() != "") {
|
||||||
|
|
|
@ -104,7 +104,7 @@ class Create extends BaseApi
|
||||||
$item = ['network' => Protocol::DFRN, 'protocol' => Conversation::PARCEL_DIRECT, 'direction' => Conversation::PUSH];
|
$item = ['network' => Protocol::DFRN, 'protocol' => Conversation::PARCEL_DIRECT, 'direction' => Conversation::PUSH];
|
||||||
$item = Event::getItemArrayForId($event_id, $item);
|
$item = Event::getItemArrayForId($event_id, $item);
|
||||||
if (Item::insert($item)) {
|
if (Item::insert($item)) {
|
||||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$item['uri-id'], $uid);
|
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$item['uri-id'], $uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App\Router;
|
||||||
use Friendica\Content\Text\Markdown;
|
use Friendica\Content\Text\Markdown;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
@ -204,7 +205,7 @@ class Statuses extends BaseApi
|
||||||
if (!empty($request['scheduled_at'])) {
|
if (!empty($request['scheduled_at'])) {
|
||||||
$item['guid'] = Item::guid($item, true);
|
$item['guid'] = Item::guid($item, true);
|
||||||
$item['uri'] = Item::newURI($item['guid']);
|
$item['uri'] = Item::newURI($item['guid']);
|
||||||
$id = Post\Delayed::add($item['uri'], $item, PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']);
|
$id = Post\Delayed::add($item['uri'], $item, Worker::PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']);
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
DI::mstdnError()->InternalError();
|
DI::mstdnError()->InternalError();
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,9 +126,9 @@ class Contact extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
// pull feed and consume it, which should subscribe to the hub.
|
// pull feed and consume it, which should subscribe to the hub.
|
||||||
Worker::add(PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
||||||
} else {
|
} else {
|
||||||
Worker::add(PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
Worker::add(Worker::PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ class FriendSuggest extends BaseModule
|
||||||
$note
|
$note
|
||||||
));
|
));
|
||||||
|
|
||||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::SUGGESTION, $suggest->id);
|
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::SUGGESTION, $suggest->id);
|
||||||
|
|
||||||
info($this->t('Friend suggestion sent.'));
|
info($this->t('Friend suggestion sent.'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,7 +338,7 @@ class Photo extends BaseModule
|
||||||
}
|
}
|
||||||
if ($update) {
|
if ($update) {
|
||||||
Logger::info('Invalid file, contact update initiated', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
|
Logger::info('Invalid file, contact update initiated', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
|
||||||
Worker::add(PRIORITY_LOW, 'UpdateContact', $id);
|
Worker::add(Worker::PRIORITY_LOW, 'UpdateContact', $id);
|
||||||
} else {
|
} else {
|
||||||
Logger::info('Invalid file', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
|
Logger::info('Invalid file', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,7 +302,7 @@ class Register extends BaseModule
|
||||||
|
|
||||||
if ($netpublish && intval(DI::config()->get('config', 'register_policy')) !== self::APPROVE) {
|
if ($netpublish && intval(DI::config()->get('config', 'register_policy')) !== self::APPROVE) {
|
||||||
$url = $base_url . '/profile/' . $user['nickname'];
|
$url = $base_url . '/profile/' . $user['nickname'];
|
||||||
Worker::add(PRIORITY_LOW, 'Directory', $url);
|
Worker::add(Worker::PRIORITY_LOW, 'Directory', $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($additional_account) {
|
if ($additional_account) {
|
||||||
|
|
|
@ -375,7 +375,7 @@ class Account extends BaseSettings
|
||||||
// "http" or "@" to be present in the string.
|
// "http" or "@" to be present in the string.
|
||||||
// All other fields from the row will be ignored
|
// All other fields from the row will be ignored
|
||||||
if ((strpos($csvRow[0], '@') !== false) || Network::isValidHttpUrl($csvRow[0])) {
|
if ((strpos($csvRow[0], '@') !== false) || Network::isValidHttpUrl($csvRow[0])) {
|
||||||
Worker::add(PRIORITY_MEDIUM, 'AddContact', local_user(), $csvRow[0]);
|
Worker::add(Worker::PRIORITY_MEDIUM, 'AddContact', local_user(), $csvRow[0]);
|
||||||
} else {
|
} else {
|
||||||
Logger::notice('Invalid account', ['url' => $csvRow[0]]);
|
Logger::notice('Invalid account', ['url' => $csvRow[0]]);
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ class Account extends BaseSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($request['relocate-submit'])) {
|
if (!empty($request['relocate-submit'])) {
|
||||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
|
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
|
||||||
info(DI::l10n()->t("Relocate message has been send to your contacts"));
|
info(DI::l10n()->t("Relocate message has been send to your contacts"));
|
||||||
DI::baseUrl()->redirect($redirectUrl);
|
DI::baseUrl()->redirect($redirectUrl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,7 +552,7 @@ class Processor
|
||||||
Logger::notice('Fetching is done by worker.', ['parent' => $activity['reply-to-id'], 'recursion-depth' => $recursion_depth]);
|
Logger::notice('Fetching is done by worker.', ['parent' => $activity['reply-to-id'], 'recursion-depth' => $recursion_depth]);
|
||||||
Fetch::add($activity['reply-to-id']);
|
Fetch::add($activity['reply-to-id']);
|
||||||
$activity['recursion-depth'] = 0;
|
$activity['recursion-depth'] = 0;
|
||||||
$wid = Worker::add(PRIORITY_HIGH, 'FetchMissingActivity', $activity['reply-to-id'], $activity, '', Receiver::COMPLETION_AUTO);
|
$wid = Worker::add(Worker::PRIORITY_HIGH, 'FetchMissingActivity', $activity['reply-to-id'], $activity, '', Receiver::COMPLETION_AUTO);
|
||||||
Fetch::setWorkerId($activity['reply-to-id'], $wid);
|
Fetch::setWorkerId($activity['reply-to-id'], $wid);
|
||||||
} else {
|
} else {
|
||||||
Logger::debug('Activity will already be fetched via a worker.', ['url' => $activity['reply-to-id']]);
|
Logger::debug('Activity will already be fetched via a worker.', ['url' => $activity['reply-to-id']]);
|
||||||
|
@ -1665,9 +1665,9 @@ class Processor
|
||||||
}
|
}
|
||||||
if (DI::config()->get('system', 'bulk_delivery')) {
|
if (DI::config()->get('system', 'bulk_delivery')) {
|
||||||
Post\Delivery::add($post['uri-id'], $uid, $inbox, $post['created'], Delivery::POST, [$cid]);
|
Post\Delivery::add($post['uri-id'], $uid, $inbox, $post['created'], Delivery::POST, [$cid]);
|
||||||
Worker::add(PRIORITY_HIGH, 'APDelivery', '', 0, $inbox, 0);
|
Worker::add(Worker::PRIORITY_HIGH, 'APDelivery', '', 0, $inbox, 0);
|
||||||
} else {
|
} else {
|
||||||
Worker::add(PRIORITY_HIGH, 'APDelivery', Delivery::POST, $post['id'], $inbox, $uid, [$cid], $post['uri-id']);
|
Worker::add(Worker::PRIORITY_HIGH, 'APDelivery', Delivery::POST, $post['id'], $inbox, $uid, [$cid], $post['uri-id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -652,7 +652,7 @@ class Receiver
|
||||||
// We delay by 5 seconds to allow to accumulate all receivers
|
// We delay by 5 seconds to allow to accumulate all receivers
|
||||||
$delayed = date(DateTimeFormat::MYSQL, time() + 5);
|
$delayed = date(DateTimeFormat::MYSQL, time() + 5);
|
||||||
Logger::debug('Initiate processing', ['id' => $object_data['entry-id'], 'uri' => $object_data['object_id']]);
|
Logger::debug('Initiate processing', ['id' => $object_data['entry-id'], 'uri' => $object_data['object_id']]);
|
||||||
$wid = Worker::add(['priority' => PRIORITY_HIGH, 'delayed' => $delayed], 'ProcessQueue', $object_data['entry-id']);
|
$wid = Worker::add(['priority' => Worker::PRIORITY_HIGH, 'delayed' => $delayed], 'ProcessQueue', $object_data['entry-id']);
|
||||||
Queue::setWorkerId($object_data['entry-id'], $wid);
|
Queue::setWorkerId($object_data['entry-id'], $wid);
|
||||||
} else {
|
} else {
|
||||||
Logger::debug('Other queue entries need to be processed first.', ['id' => $object_data['entry-id']]);
|
Logger::debug('Other queue entries need to be processed first.', ['id' => $object_data['entry-id']]);
|
||||||
|
|
|
@ -2020,7 +2020,7 @@ class Diaspora
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info('Deliver participation', ['item' => $comment['id'], 'contact' => $author_contact['cid']]);
|
Logger::info('Deliver participation', ['item' => $comment['id'], 'contact' => $author_contact['cid']]);
|
||||||
if (Worker::add(PRIORITY_HIGH, 'Delivery', Delivery::POST, $comment['uri-id'], $author_contact['cid'], $datarray['uid'])) {
|
if (Worker::add(Worker::PRIORITY_HIGH, 'Delivery', Delivery::POST, $comment['uri-id'], $author_contact['cid'], $datarray['uid'])) {
|
||||||
Post\DeliveryData::incrementQueueCount($comment['uri-id'], 1);
|
Post\DeliveryData::incrementQueueCount($comment['uri-id'], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Content\Text\HTML;
|
||||||
use Friendica\Core\Cache\Enum\Duration;
|
use Friendica\Core\Cache\Enum\Duration;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
@ -630,7 +631,7 @@ class Feed
|
||||||
unset($item['parent-uri']);
|
unset($item['parent-uri']);
|
||||||
|
|
||||||
// Set the delivery priority for "remote self" to "medium"
|
// Set the delivery priority for "remote self" to "medium"
|
||||||
$notify = PRIORITY_MEDIUM;
|
$notify = Worker::PRIORITY_MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
$condition = ['uid' => $item['uid'], 'uri' => $item['uri']];
|
$condition = ['uid' => $item['uid'], 'uri' => $item['uri']];
|
||||||
|
|
|
@ -34,7 +34,7 @@ class CheckDeletedContacts
|
||||||
{
|
{
|
||||||
$contacts = DBA::select('contact', ['id'], ['deleted' => true]);
|
$contacts = DBA::select('contact', ['id'], ['deleted' => true]);
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
Worker::add(PRIORITY_MEDIUM, 'Contact\Remove', $contact['id']);
|
Worker::add(Worker::PRIORITY_MEDIUM, 'Contact\Remove', $contact['id']);
|
||||||
}
|
}
|
||||||
DBA::close($contacts);
|
DBA::close($contacts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,25 +62,25 @@ class Cron
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fork the cron jobs in separate parts to avoid problems when one of them is crashing
|
// Fork the cron jobs in separate parts to avoid problems when one of them is crashing
|
||||||
Hook::fork(PRIORITY_MEDIUM, 'cron');
|
Hook::fork(Worker::PRIORITY_MEDIUM, 'cron');
|
||||||
|
|
||||||
// Poll contacts
|
// Poll contacts
|
||||||
Worker::add(PRIORITY_MEDIUM, 'PollContacts');
|
Worker::add(Worker::PRIORITY_MEDIUM, 'PollContacts');
|
||||||
|
|
||||||
// Update contact information
|
// Update contact information
|
||||||
Worker::add(PRIORITY_LOW, 'UpdateContacts');
|
Worker::add(Worker::PRIORITY_LOW, 'UpdateContacts');
|
||||||
|
|
||||||
// Update server information
|
// Update server information
|
||||||
Worker::add(PRIORITY_LOW, 'UpdateGServers');
|
Worker::add(Worker::PRIORITY_LOW, 'UpdateGServers');
|
||||||
|
|
||||||
// run the process to update server directories in the background
|
// run the process to update server directories in the background
|
||||||
Worker::add(PRIORITY_LOW, 'UpdateServerDirectories');
|
Worker::add(Worker::PRIORITY_LOW, 'UpdateServerDirectories');
|
||||||
|
|
||||||
// Expire and remove user entries
|
// Expire and remove user entries
|
||||||
Worker::add(PRIORITY_MEDIUM, 'ExpireAndRemoveUsers');
|
Worker::add(Worker::PRIORITY_MEDIUM, 'ExpireAndRemoveUsers');
|
||||||
|
|
||||||
// Call possible post update functions
|
// Call possible post update functions
|
||||||
Worker::add(PRIORITY_LOW, 'PostUpdate');
|
Worker::add(Worker::PRIORITY_LOW, 'PostUpdate');
|
||||||
|
|
||||||
// Hourly cron calls
|
// Hourly cron calls
|
||||||
if (DI::config()->get('system', 'last_cron_hourly', 0) + 3600 < time()) {
|
if (DI::config()->get('system', 'last_cron_hourly', 0) + 3600 < time()) {
|
||||||
|
@ -97,11 +97,11 @@ class Cron
|
||||||
|
|
||||||
// Search for new contacts in the directory
|
// Search for new contacts in the directory
|
||||||
if (DI::config()->get('system', 'synchronize_directory')) {
|
if (DI::config()->get('system', 'synchronize_directory')) {
|
||||||
Worker::add(PRIORITY_LOW, 'PullDirectory');
|
Worker::add(Worker::PRIORITY_LOW, 'PullDirectory');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear cache entries
|
// Clear cache entries
|
||||||
Worker::add(PRIORITY_LOW, 'ClearCache');
|
Worker::add(Worker::PRIORITY_LOW, 'ClearCache');
|
||||||
|
|
||||||
DI::config()->set('system', 'last_cron_hourly', time());
|
DI::config()->set('system', 'last_cron_hourly', time());
|
||||||
}
|
}
|
||||||
|
@ -109,27 +109,27 @@ class Cron
|
||||||
// Daily maintenance cron calls
|
// Daily maintenance cron calls
|
||||||
if (Worker::isInMaintenanceWindow(true)) {
|
if (Worker::isInMaintenanceWindow(true)) {
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'UpdateContactBirthdays');
|
Worker::add(Worker::PRIORITY_LOW, 'UpdateContactBirthdays');
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'UpdatePhotoAlbums');
|
Worker::add(Worker::PRIORITY_LOW, 'UpdatePhotoAlbums');
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'ExpirePosts');
|
Worker::add(Worker::PRIORITY_LOW, 'ExpirePosts');
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'ExpireActivities');
|
Worker::add(Worker::PRIORITY_LOW, 'ExpireActivities');
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'RemoveUnusedTags');
|
Worker::add(Worker::PRIORITY_LOW, 'RemoveUnusedTags');
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'RemoveUnusedContacts');
|
Worker::add(Worker::PRIORITY_LOW, 'RemoveUnusedContacts');
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'RemoveUnusedAvatars');
|
Worker::add(Worker::PRIORITY_LOW, 'RemoveUnusedAvatars');
|
||||||
|
|
||||||
// check upstream version?
|
// check upstream version?
|
||||||
Worker::add(PRIORITY_LOW, 'CheckVersion');
|
Worker::add(Worker::PRIORITY_LOW, 'CheckVersion');
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'CheckDeletedContacts');
|
Worker::add(Worker::PRIORITY_LOW, 'CheckDeletedContacts');
|
||||||
|
|
||||||
if (DI::config()->get('system', 'optimize_tables')) {
|
if (DI::config()->get('system', 'optimize_tables')) {
|
||||||
Worker::add(PRIORITY_LOW, 'OptimizeTables');
|
Worker::add(Worker::PRIORITY_LOW, 'OptimizeTables');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resubscribe to relay servers
|
// Resubscribe to relay servers
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Directory
|
||||||
private static function updateAll() {
|
private static function updateAll() {
|
||||||
$users = DBA::select('owner-view', ['url'], ['net-publish' => true, 'account_expired' => false, 'verified' => true]);
|
$users = DBA::select('owner-view', ['url'], ['net-publish' => true, 'account_expired' => false, 'verified' => true]);
|
||||||
while ($user = DBA::fetch($users)) {
|
while ($user = DBA::fetch($users)) {
|
||||||
Worker::add(PRIORITY_LOW, 'Directory', $user['url']);
|
Worker::add(Worker::PRIORITY_LOW, 'Directory', $user['url']);
|
||||||
}
|
}
|
||||||
DBA::close($users);
|
DBA::close($users);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,10 @@ class ExpirePosts
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the expiry for origin posta
|
// Set the expiry for origin posta
|
||||||
Worker::add(PRIORITY_LOW, 'Expire');
|
Worker::add(Worker::PRIORITY_LOW, 'Expire');
|
||||||
|
|
||||||
// update nodeinfo data after everything is cleaned up
|
// update nodeinfo data after everything is cleaned up
|
||||||
Worker::add(PRIORITY_LOW, 'NodeInfo');
|
Worker::add(Worker::PRIORITY_LOW, 'NodeInfo');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,7 +37,7 @@ class MoveStorage
|
||||||
$moved = DI::storageManager()->move($current);
|
$moved = DI::storageManager()->move($current);
|
||||||
|
|
||||||
if ($moved) {
|
if ($moved) {
|
||||||
Worker::add(PRIORITY_LOW, 'MoveStorage');
|
Worker::add(Worker::PRIORITY_LOW, 'MoveStorage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class Notifier
|
||||||
foreach ($inboxes as $inbox => $receivers) {
|
foreach ($inboxes as $inbox => $receivers) {
|
||||||
$ap_contacts = array_merge($ap_contacts, $receivers);
|
$ap_contacts = array_merge($ap_contacts, $receivers);
|
||||||
Logger::info('Delivery via ActivityPub', ['cmd' => $cmd, 'target' => $target_id, 'inbox' => $inbox]);
|
Logger::info('Delivery via ActivityPub', ['cmd' => $cmd, 'target' => $target_id, 'inbox' => $inbox]);
|
||||||
Worker::add(['priority' => PRIORITY_HIGH, 'created' => $a->getQueueValue('created'), 'dont_fork' => true],
|
Worker::add(['priority' => Worker::PRIORITY_HIGH, 'created' => $a->getQueueValue('created'), 'dont_fork' => true],
|
||||||
'APDelivery', $cmd, $target_id, $inbox, $uid, $receivers, $post_uriid);
|
'APDelivery', $cmd, $target_id, $inbox, $uid, $receivers, $post_uriid);
|
||||||
}
|
}
|
||||||
} elseif ($cmd == Delivery::SUGGESTION) {
|
} elseif ($cmd == Delivery::SUGGESTION) {
|
||||||
|
@ -568,7 +568,7 @@ class Notifier
|
||||||
// Situation is that sometimes Friendica servers receive Friendica posts over the Diaspora protocol first.
|
// Situation is that sometimes Friendica servers receive Friendica posts over the Diaspora protocol first.
|
||||||
// The conversion in Markdown reduces the formatting, so these posts should arrive after the Friendica posts.
|
// The conversion in Markdown reduces the formatting, so these posts should arrive after the Friendica posts.
|
||||||
// This is only important for high and medium priority tasks and not for Low priority jobs like deletions.
|
// This is only important for high and medium priority tasks and not for Low priority jobs like deletions.
|
||||||
if (($contact['network'] == Protocol::DIASPORA) && in_array($a->getQueueValue('priority'), [PRIORITY_HIGH, PRIORITY_MEDIUM])) {
|
if (($contact['network'] == Protocol::DIASPORA) && in_array($a->getQueueValue('priority'), [Worker::PRIORITY_HIGH, Worker::PRIORITY_MEDIUM])) {
|
||||||
$deliver_options = ['priority' => $a->getQueueValue('priority'), 'dont_fork' => true];
|
$deliver_options = ['priority' => $a->getQueueValue('priority'), 'dont_fork' => true];
|
||||||
} else {
|
} else {
|
||||||
$deliver_options = ['priority' => $a->getQueueValue('priority'), 'created' => $a->getQueueValue('created'), 'dont_fork' => true];
|
$deliver_options = ['priority' => $a->getQueueValue('priority'), 'created' => $a->getQueueValue('created'), 'dont_fork' => true];
|
||||||
|
@ -698,7 +698,7 @@ class Notifier
|
||||||
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($self_user_id);
|
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($self_user_id);
|
||||||
foreach ($inboxes as $inbox => $receivers) {
|
foreach ($inboxes as $inbox => $receivers) {
|
||||||
Logger::info('Account removal via ActivityPub', ['uid' => $self_user_id, 'inbox' => $inbox]);
|
Logger::info('Account removal via ActivityPub', ['uid' => $self_user_id, 'inbox' => $inbox]);
|
||||||
Worker::add(['priority' => PRIORITY_NEGLIGIBLE, 'created' => $created, 'dont_fork' => true],
|
Worker::add(['priority' => Worker::PRIORITY_NEGLIGIBLE, 'created' => $created, 'dont_fork' => true],
|
||||||
'APDelivery', Delivery::REMOVAL, 0, $inbox, $self_user_id, $receivers);
|
'APDelivery', Delivery::REMOVAL, 0, $inbox, $self_user_id, $receivers);
|
||||||
Worker::coolDown();
|
Worker::coolDown();
|
||||||
}
|
}
|
||||||
|
@ -817,7 +817,7 @@ class Notifier
|
||||||
if (DI::config()->get('system', 'bulk_delivery')) {
|
if (DI::config()->get('system', 'bulk_delivery')) {
|
||||||
$delivery_queue_count++;
|
$delivery_queue_count++;
|
||||||
Post\Delivery::add($target_item['uri-id'], $uid, $inbox, $target_item['created'], $cmd, $receivers);
|
Post\Delivery::add($target_item['uri-id'], $uid, $inbox, $target_item['created'], $cmd, $receivers);
|
||||||
Worker::add(PRIORITY_HIGH, 'APDelivery', '', 0, $inbox, 0);
|
Worker::add(Worker::PRIORITY_HIGH, 'APDelivery', '', 0, $inbox, 0);
|
||||||
} else {
|
} else {
|
||||||
if (Worker::add(['priority' => $priority, 'created' => $created, 'dont_fork' => true],
|
if (Worker::add(['priority' => $priority, 'created' => $created, 'dont_fork' => true],
|
||||||
'APDelivery', $cmd, $target_item['id'], $inbox, $uid, $receivers, $target_item['uri-id'])) {
|
'APDelivery', $cmd, $target_item['id'], $inbox, $uid, $receivers, $target_item['uri-id'])) {
|
||||||
|
@ -834,7 +834,7 @@ class Notifier
|
||||||
if (DI::config()->get('system', 'bulk_delivery')) {
|
if (DI::config()->get('system', 'bulk_delivery')) {
|
||||||
$delivery_queue_count++;
|
$delivery_queue_count++;
|
||||||
Post\Delivery::add($target_item['uri-id'], $uid, $inbox, $target_item['created'], $cmd, []);
|
Post\Delivery::add($target_item['uri-id'], $uid, $inbox, $target_item['created'], $cmd, []);
|
||||||
Worker::add(PRIORITY_MEDIUM, 'APDelivery', '', 0, $inbox, 0);
|
Worker::add(Worker::PRIORITY_MEDIUM, 'APDelivery', '', 0, $inbox, 0);
|
||||||
} else {
|
} else {
|
||||||
if (Worker::add(['priority' => $priority, 'dont_fork' => true], 'APDelivery', $cmd, $target_item['id'], $inbox, $uid, [], $target_item['uri-id'])) {
|
if (Worker::add(['priority' => $priority, 'dont_fork' => true], 'APDelivery', $cmd, $target_item['id'], $inbox, $uid, [], $target_item['uri-id'])) {
|
||||||
$delivery_queue_count++;
|
$delivery_queue_count++;
|
||||||
|
|
|
@ -71,11 +71,11 @@ class PollContacts
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((($contact['network'] == Protocol::FEED) && ($contact['priority'] <= 3)) || ($contact['network'] == Protocol::MAIL)) {
|
if ((($contact['network'] == Protocol::FEED) && ($contact['priority'] <= 3)) || ($contact['network'] == Protocol::MAIL)) {
|
||||||
$priority = PRIORITY_MEDIUM;
|
$priority = Worker::PRIORITY_MEDIUM;
|
||||||
} elseif ($contact['archive']) {
|
} elseif ($contact['archive']) {
|
||||||
$priority = PRIORITY_NEGLIGIBLE;
|
$priority = Worker::PRIORITY_NEGLIGIBLE;
|
||||||
} else {
|
} else {
|
||||||
$priority = PRIORITY_LOW;
|
$priority = Worker::PRIORITY_LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::notice("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact['priority'] . " " . $contact["nick"] . " " . $contact["name"]);
|
Logger::notice("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact['priority'] . " " . $contact["nick"] . " " . $contact["name"]);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
namespace Friendica\Worker;
|
namespace Friendica\Worker;
|
||||||
|
|
||||||
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\Post;
|
use Friendica\Model\Post;
|
||||||
|
@ -48,7 +49,7 @@ class RemoveUser {
|
||||||
do {
|
do {
|
||||||
$items = Post::select(['id'], $condition, ['limit' => 100]);
|
$items = Post::select(['id'], $condition, ['limit' => 100]);
|
||||||
while ($item = Post::fetch($items)) {
|
while ($item = Post::fetch($items)) {
|
||||||
Item::markForDeletionById($item['id'], PRIORITY_NEGLIGIBLE);
|
Item::markForDeletionById($item['id'], Worker::PRIORITY_NEGLIGIBLE);
|
||||||
}
|
}
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
} while (Post::exists($condition));
|
} while (Post::exists($condition));
|
||||||
|
|
|
@ -59,7 +59,7 @@ class UpdateContacts
|
||||||
$contacts = DBA::select('contact', ['id'], $condition, ['order' => ['next-update'], 'limit' => $limit]);
|
$contacts = DBA::select('contact', ['id'], $condition, ['order' => ['next-update'], 'limit' => $limit]);
|
||||||
$count = 0;
|
$count = 0;
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
if (Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], "UpdateContact", $contact['id'])) {
|
if (Worker::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], "UpdateContact", $contact['id'])) {
|
||||||
++$count;
|
++$count;
|
||||||
}
|
}
|
||||||
Worker::coolDown();
|
Worker::coolDown();
|
||||||
|
|
|
@ -63,12 +63,12 @@ class UpdateGServers
|
||||||
// There are duplicated "url" but not "nurl". So we check both addresses instead of just overwriting them,
|
// There are duplicated "url" but not "nurl". So we check both addresses instead of just overwriting them,
|
||||||
// since that would mean loosing data.
|
// since that would mean loosing data.
|
||||||
if (!empty($gserver['url'])) {
|
if (!empty($gserver['url'])) {
|
||||||
if (Worker::add(PRIORITY_LOW, 'UpdateGServer', $gserver['url'])) {
|
if (Worker::add(Worker::PRIORITY_LOW, 'UpdateGServer', $gserver['url'])) {
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($gserver['nurl']) && ($gserver['nurl'] != Strings::normaliseLink($gserver['url']))) {
|
if (!empty($gserver['nurl']) && ($gserver['nurl'] != Strings::normaliseLink($gserver['url']))) {
|
||||||
if (Worker::add(PRIORITY_LOW, 'UpdateGServer', $gserver['nurl'])) {
|
if (Worker::add(Worker::PRIORITY_LOW, 'UpdateGServer', $gserver['nurl'])) {
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ return [
|
||||||
|
|
||||||
// expire-notify-priority (integer)
|
// expire-notify-priority (integer)
|
||||||
// Priority for the expirary notification
|
// Priority for the expirary notification
|
||||||
'expire-notify-priority' => PRIORITY_LOW,
|
'expire-notify-priority' => Friendica\Core\Worker::PRIORITY_LOW,
|
||||||
|
|
||||||
// fetch_by_worker (Boolean)
|
// fetch_by_worker (Boolean)
|
||||||
// Fetch missing posts via a background process
|
// Fetch missing posts via a background process
|
||||||
|
|
|
@ -131,7 +131,7 @@ function update_1309()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$deliver_options = ['priority' => PRIORITY_MEDIUM, 'dont_fork' => true];
|
$deliver_options = ['priority' => Worker::PRIORITY_MEDIUM, 'dont_fork' => true];
|
||||||
Worker::add($deliver_options, 'Delivery', Delivery::POST, $item['id'], $entry['cid']);
|
Worker::add($deliver_options, 'Delivery', Delivery::POST, $item['id'], $entry['cid']);
|
||||||
Logger::info('Added delivery worker', ['item' => $item['id'], 'contact' => $entry['cid']]);
|
Logger::info('Added delivery worker', ['item' => $item['id'], 'contact' => $entry['cid']]);
|
||||||
DBA::delete('queue', ['id' => $entry['id']]);
|
DBA::delete('queue', ['id' => $entry['id']]);
|
||||||
|
@ -152,7 +152,7 @@ function update_1318()
|
||||||
DBA::update('profile', ['marital' => 'In a relation'], ['marital' => 'Unavailable']);
|
DBA::update('profile', ['marital' => 'In a relation'], ['marital' => 'Unavailable']);
|
||||||
DBA::update('profile', ['marital' => 'Single'], ['marital' => 'Available']);
|
DBA::update('profile', ['marital' => 'Single'], ['marital' => 'Available']);
|
||||||
|
|
||||||
Worker::add(PRIORITY_LOW, 'ProfileUpdate');
|
Worker::add(Worker::PRIORITY_LOW, 'ProfileUpdate');
|
||||||
return Update::SUCCESS;
|
return Update::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue