Skip to content

Commit 6149965

Browse files
committed
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>
1 parent 79a1cc0 commit 6149965

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/private/TaskProcessing/Manager.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,18 +1233,15 @@ public function setTaskIntermediateOutput(int $id, array $output): bool {
12331233
$userId = $task->getUserId();
12341234
if ($userId !== null && $userId !== '' && $this->appManager->isEnabledForAnyone('notify_push')) {
12351235
try {
1236-
// $this->appManager->loadApp('notify_push');
12371236
$queue = Server::get(\OCA\NotifyPush\Queue\IQueue::class);
1238-
// $queue = $this->serverContainer->get(\OCA\NotifyPush\Queue\IQueue::class);
12391237
$queue->push('notify_custom', [
12401238
'user' => $userId,
12411239
'message' => 'task_' . $task->getId(),
12421240
'body' => $output,
12431241
]);
1244-
error_log('sending to queue!!!!!!');
1242+
return true;
12451243
} catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) {
12461244
$this->logger->debug('OCA\NotifyPush\IQueue not found, not sending to queue');
1247-
error_log('NOT sending to queue!!!!!! ' . $e->getMessage());
12481245
}
12491246
}
12501247
// no output shape validation for now

lib/public/TaskProcessing/IManager.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,15 @@ public function cancelTask(int $id): void;
144144
public function setTaskResult(int $id, ?string $error, ?array $result, bool $isUsingFileIds = false, ?string $userFacingError = null): void;
145145

146146
/**
147+
* Set the task intermediate output.
148+
* If notify_push is available, the output will be pushed to the user and the task won't be updated in the DB.
149+
*
147150
* @param int $id The id of the task
148-
* @param array $output
151+
* @param array $output The intermediate output
149152
* @return bool `true` if the task should still be running; `false` if the task has been cancelled in the meantime
150153
* @throws Exception If the query failed
151154
* @throws NotFoundException If the task could not be found
152-
* @since 34.0.0
155+
* @since 35.0.0
153156
*/
154157
public function setTaskIntermediateOutput(int $id, array $output): bool;
155158

0 commit comments

Comments
 (0)