From 614996563b4d7a8a7aebe8ccccd1c68318862c3d Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Thu, 21 May 2026 14:30:29 +0200 Subject: [PATCH] feat(task-streaming): do not update the task in DB when setting intermediate result if notify_push is available Signed-off-by: Julien Veyssier --- lib/private/TaskProcessing/Manager.php | 5 +---- lib/public/TaskProcessing/IManager.php | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 59d0c5dfca8..ac909681c2f 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -1233,18 +1233,15 @@ class Manager implements IManager { $userId = $task->getUserId(); if ($userId !== null && $userId !== '' && $this->appManager->isEnabledForAnyone('notify_push')) { try { - // $this->appManager->loadApp('notify_push'); $queue = Server::get(\OCA\NotifyPush\Queue\IQueue::class); - // $queue = $this->serverContainer->get(\OCA\NotifyPush\Queue\IQueue::class); $queue->push('notify_custom', [ 'user' => $userId, 'message' => 'task_' . $task->getId(), 'body' => $output, ]); - error_log('sending to queue!!!!!!'); + return true; } catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) { $this->logger->debug('OCA\NotifyPush\IQueue not found, not sending to queue'); - error_log('NOT sending to queue!!!!!! ' . $e->getMessage()); } } // no output shape validation for now diff --git a/lib/public/TaskProcessing/IManager.php b/lib/public/TaskProcessing/IManager.php index f919410d7c4..b09ea35fdca 100644 --- a/lib/public/TaskProcessing/IManager.php +++ b/lib/public/TaskProcessing/IManager.php @@ -144,12 +144,15 @@ interface IManager { public function setTaskResult(int $id, ?string $error, ?array $result, bool $isUsingFileIds = false, ?string $userFacingError = null): void; /** + * Set the task intermediate output. + * If notify_push is available, the output will be pushed to the user and the task won't be updated in the DB. + * * @param int $id The id of the task - * @param array $output + * @param array $output The intermediate output * @return bool `true` if the task should still be running; `false` if the task has been cancelled in the meantime * @throws Exception If the query failed * @throws NotFoundException If the task could not be found - * @since 34.0.0 + * @since 35.0.0 */ public function setTaskIntermediateOutput(int $id, array $output): bool;