feat(task-streaming): do not update the task in DB when setting intermediate result if notify_push is available

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
Julien Veyssier 2026-05-21 14:30:29 +02:00
parent 79a1cc0c7d
commit 614996563b
No known key found for this signature in database
GPG key ID: 4141FEE162030638
2 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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;