Changes after code review

pull/11457/head
Michael 2022-05-05 12:23:44 +00:00
rodzic ab42fd88a4
commit 2433fee461
7 zmienionych plików z 6 dodań i 59 usunięć

Wyświetl plik

@ -1132,7 +1132,7 @@ CREATE TABLE IF NOT EXISTS `post-delivery` (
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`inbox-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Status of ActivityPub inboxes';
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for posts for the batch processing';
--
-- TABLE post-delivery-data

Wyświetl plik

@ -50,7 +50,7 @@ Database Tables
| [post-category](help/database/db_post-category) | post relation to categories |
| [post-collection](help/database/db_post-collection) | Collection of posts |
| [post-content](help/database/db_post-content) | Content for all posts |
| [post-delivery](help/database/db_post-delivery) | Status of ActivityPub inboxes |
| [post-delivery](help/database/db_post-delivery) | Delivery data for posts for the batch processing |
| [post-delivery-data](help/database/db_post-delivery-data) | Delivery data for items |
| [post-link](help/database/db_post-link) | Post related external links |
| [post-media](help/database/db_post-media) | Attached media |

Wyświetl plik

@ -1,7 +1,7 @@
Table post-delivery
===========
Status of ActivityPub inboxes
Delivery data for posts for the batch processing
Fields
------

Wyświetl plik

@ -672,7 +672,8 @@ function item_post(App $a) {
'attach' => $datarray['attach'],
'file' => $datarray['file'],
'edited' => DateTimeFormat::utcNow(),
'changed' => DateTimeFormat::utcNow()];
'changed' => DateTimeFormat::utcNow()
];
Item::update($fields, ['id' => $post_id]);
Item::updateDisplayCache($datarray['uri-id']);

Wyświetl plik

@ -1,51 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* 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 <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Worker;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Util\DateTimeFormat;
/**
* Delete all done workerqueue entries
*/
class CleanWorkerQueue
{
public static function execute()
{
DBA::delete('workerqueue', ["`done` AND `executed` < ?", DateTimeFormat::utc('now - 1 hour')]);
// Optimizing this table only last seconds
if (DI::config()->get('system', 'optimize_tables')) {
// We are acquiring the two locks from the worker to avoid locking problems
if (DI::lock()->acquire(Worker::LOCK_PROCESS, 10)) {
if (DI::lock()->acquire(Worker::LOCK_WORKER, 10)) {
DBA::e("OPTIMIZE TABLE `workerqueue`");
DBA::e("OPTIMIZE TABLE `process`");
DI::lock()->release(Worker::LOCK_WORKER);
}
DI::lock()->release(Worker::LOCK_PROCESS);
}
}
}
}

Wyświetl plik

@ -92,9 +92,6 @@ class Cron
Worker::add(PRIORITY_LOW, 'PullDirectory');
}
// Delete all done workerqueue entries
Worker::add(PRIORITY_LOW, 'CleanWorkerQueue');
// Clear cache entries
Worker::add(PRIORITY_LOW, 'ClearCache');

Wyświetl plik

@ -1158,7 +1158,7 @@ return [
]
],
"post-delivery" => [
"comment" => "Status of ActivityPub inboxes",
"comment" => "Delivery data for posts for the batch processing",
"fields" => [
"uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
"inbox-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Item-uri id of inbox url"],