mirror of
https://github.com/nextcloud/server.git
synced 2026-05-21 17:45:40 -04:00
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:
parent
79a1cc0c7d
commit
614996563b
2 changed files with 6 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue