From bb94b17959c5d2a911968f33a02b536484d00bcf Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Fri, 6 Sep 2024 17:23:31 +0530 Subject: [PATCH 1/2] fix(TaskProcessing): increase error_message column length Signed-off-by: Anupam Kumar --- .../Version30000Date20240906095113.php | 40 +++++++++++++++++++ lib/private/TaskProcessing/Manager.php | 5 ++- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 core/Migrations/Version30000Date20240906095113.php diff --git a/core/Migrations/Version30000Date20240906095113.php b/core/Migrations/Version30000Date20240906095113.php new file mode 100644 index 0000000000000..4991aecb078a7 --- /dev/null +++ b/core/Migrations/Version30000Date20240906095113.php @@ -0,0 +1,40 @@ +getTable('taskprocessing_tasks'); + $column = $table->getColumn('error_message'); + + if ($column->getLength() < 4000) { + $column->setLength(4000); + } + + return $schema; + } +} diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 1b170a03ec2c1..29153ca56f980 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -891,7 +891,8 @@ public function setTaskResult(int $id, ?string $error, ?array $result, bool $isU if ($error !== null) { $task->setStatus(Task::STATUS_FAILED); $task->setEndedAt(time()); - $task->setErrorMessage($error); + // truncate error message to 1000 characters + $task->setErrorMessage(mb_substr($error, 0, 1000)); $this->logger->warning('A TaskProcessing ' . $task->getTaskTypeId() . ' task with id ' . $id . ' failed with the following message: ' . $error); } elseif ($result !== null) { $taskTypes = $this->getAvailableTaskTypes(); @@ -956,7 +957,7 @@ public function setTaskResult(int $id, ?string $error, ?array $result, bool $isU $this->taskMapper->update($taskEntity); $this->runWebhook($task); } catch (\OCP\DB\Exception $e) { - throw new \OCP\TaskProcessing\Exception\Exception('There was a problem finding the task', 0, $e); + throw new \OCP\TaskProcessing\Exception\Exception($e->getMessage()); } if ($task->getStatus() === Task::STATUS_SUCCESSFUL) { $event = new TaskSuccessfulEvent($task); From 31a983ac69914feb1feacb0fad7c5d83c5e3141a Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Fri, 6 Sep 2024 18:02:15 +0530 Subject: [PATCH 2/2] chore: update autoloader Signed-off-by: Anupam Kumar --- lib/composer/composer/autoload_classmap.php | 1 + lib/composer/composer/autoload_static.php | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 9710ff7dbd5ec..4bd8f96454e25 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -1375,6 +1375,7 @@ 'OC\\Core\\Migrations\\Version30000Date20240717111406' => $baseDir . '/core/Migrations/Version30000Date20240717111406.php', 'OC\\Core\\Migrations\\Version30000Date20240814180800' => $baseDir . '/core/Migrations/Version30000Date20240814180800.php', 'OC\\Core\\Migrations\\Version30000Date20240815080800' => $baseDir . '/core/Migrations/Version30000Date20240815080800.php', + 'OC\\Core\\Migrations\\Version30000Date20240906095113' => $baseDir . '/core/Migrations/Version30000Date20240906095113.php', 'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php', 'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php', 'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index a681b10aa5116..a9737d27c8373 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -1408,6 +1408,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2 'OC\\Core\\Migrations\\Version30000Date20240717111406' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240717111406.php', 'OC\\Core\\Migrations\\Version30000Date20240814180800' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240814180800.php', 'OC\\Core\\Migrations\\Version30000Date20240815080800' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240815080800.php', + 'OC\\Core\\Migrations\\Version30000Date20240906095113' => __DIR__ . '/../../..' . '/core/Migrations/Version30000Date20240906095113.php', 'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php', 'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php', 'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',