From 2433fee461a8c3e284681f402442388350a3734d Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 5 May 2022 12:23:44 +0000 Subject: [PATCH] Changes after code review --- database.sql | 2 +- doc/database.md | 2 +- doc/database/db_post-delivery.md | 2 +- mod/item.php | 3 +- src/Worker/CleanWorkerQueue.php | 51 -------------------------------- src/Worker/Cron.php | 3 -- static/dbstructure.config.php | 2 +- 7 files changed, 6 insertions(+), 59 deletions(-) delete mode 100644 src/Worker/CleanWorkerQueue.php diff --git a/database.sql b/database.sql index f0d5854623..1d632eb3fb 100644 --- a/database.sql +++ b/database.sql @@ -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 diff --git a/doc/database.md b/doc/database.md index 961e8183ab..bd5bef445b 100644 --- a/doc/database.md +++ b/doc/database.md @@ -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 | diff --git a/doc/database/db_post-delivery.md b/doc/database/db_post-delivery.md index 1937e059a5..79e858193a 100644 --- a/doc/database/db_post-delivery.md +++ b/doc/database/db_post-delivery.md @@ -1,7 +1,7 @@ Table post-delivery =========== -Status of ActivityPub inboxes +Delivery data for posts for the batch processing Fields ------ diff --git a/mod/item.php b/mod/item.php index 34475188ea..71c1568f6d 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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']); diff --git a/src/Worker/CleanWorkerQueue.php b/src/Worker/CleanWorkerQueue.php deleted file mode 100644 index eb9b329a55..0000000000 --- a/src/Worker/CleanWorkerQueue.php +++ /dev/null @@ -1,51 +0,0 @@ -. - * - */ - -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); - } - } - } -} diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 0cf5e26323..01c54fed18 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -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'); diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index df0d469fce..08634290b7 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -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"],