Skip to content

Commit deefec1

Browse files
authored
Merge pull request #61197 from nextcloud/enh/noid/streaming-adjustments
On behalf of Julien's request
2 parents 045905b + d8477ed commit deefec1

8 files changed

Lines changed: 41 additions & 3 deletions

File tree

core/Controller/TaskProcessingApiController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,13 @@ public function taskTypesExAppEndpoint(): DataResponse {
164164
private function handleScheduleTaskInternal(
165165
array $input, string $type, string $appId, string $customId = '',
166166
?string $webhookUri = null, ?string $webhookMethod = null, bool $includeWatermark = true,
167+
bool $preferStreaming = false,
167168
): DataResponse {
168169
$task = new Task($type, $input, $appId, $this->userId, $customId);
169170
$task->setWebhookUri($webhookUri);
170171
$task->setWebhookMethod($webhookMethod);
171172
$task->setIncludeWatermark($includeWatermark);
173+
$task->setPreferStreaming($preferStreaming);
172174
try {
173175
$this->taskProcessingManager->scheduleTask($task);
174176

@@ -202,6 +204,7 @@ private function handleScheduleTaskInternal(
202204
* @param string|null $webhookUri URI to be requested when the task finishes
203205
* @param string|null $webhookMethod Method used for the webhook request (HTTP:GET, HTTP:POST, HTTP:PUT, HTTP:DELETE or AppAPI:APP_ID:GET, AppAPI:APP_ID:POST...)
204206
* @param bool $includeWatermark Whether to include a watermark in the output file or not
207+
* @param bool $preferStreaming Whether to prefer getting a progressive output from the provider or not
205208
* @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_BAD_REQUEST|Http::STATUS_PRECONDITION_FAILED|Http::STATUS_UNAUTHORIZED, array{message: string}, array{}>
206209
*
207210
* 200: Task scheduled successfully
@@ -215,6 +218,7 @@ private function handleScheduleTaskInternal(
215218
public function schedule(
216219
array $input, string $type, string $appId, string $customId = '',
217220
?string $webhookUri = null, ?string $webhookMethod = null, bool $includeWatermark = true,
221+
bool $preferStreaming = false,
218222
): DataResponse {
219223
return $this->handleScheduleTaskInternal(
220224
$input,
@@ -224,6 +228,7 @@ public function schedule(
224228
$webhookUri,
225229
$webhookMethod,
226230
$includeWatermark,
231+
$preferStreaming,
227232
);
228233
}
229234

@@ -239,6 +244,7 @@ public function schedule(
239244
* @param string|null $webhookUri URI to be requested when the task finishes
240245
* @param string|null $webhookMethod Method used for the webhook request (HTTP:GET, HTTP:POST, HTTP:PUT, HTTP:DELETE or AppAPI:APP_ID:GET, AppAPI:APP_ID:POST...)
241246
* @param bool $includeWatermark Whether to include a watermark in the output file or not
247+
* @param bool $preferStreaming Whether to prefer getting a progressive output from the provider or not
242248
* @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_BAD_REQUEST|Http::STATUS_PRECONDITION_FAILED|Http::STATUS_UNAUTHORIZED, array{message: string}, array{}>
243249
*
244250
* 200: Task scheduled successfully
@@ -251,6 +257,7 @@ public function schedule(
251257
public function scheduleExAppEndpoint(
252258
array $input, string $type, string $appId, string $customId = '',
253259
?string $webhookUri = null, ?string $webhookMethod = null, bool $includeWatermark = true,
260+
bool $preferStreaming = false,
254261
): DataResponse {
255262
return $this->handleScheduleTaskInternal(
256263
$input,
@@ -260,6 +267,7 @@ public function scheduleExAppEndpoint(
260267
$webhookUri,
261268
$webhookMethod,
262269
$includeWatermark,
270+
$preferStreaming,
263271
);
264272
}
265273

core/Migrations/Version35000Date20260527162338.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3939
if (!$table->hasColumn('prefer_streaming')) {
4040
$table->addColumn('prefer_streaming', Types::SMALLINT, [
4141
'notnull' => true,
42-
'default' => 1,
42+
'default' => 0,
4343
'unsigned' => true,
4444
]);
4545
return $schema;

core/openapi-ex_app.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,11 @@
647647
"type": "boolean",
648648
"default": true,
649649
"description": "Whether to include a watermark in the output file or not"
650+
},
651+
"preferStreaming": {
652+
"type": "boolean",
653+
"default": false,
654+
"description": "Whether to prefer getting a progressive output from the provider or not"
650655
}
651656
}
652657
}

core/openapi-full.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5098,6 +5098,11 @@
50985098
"type": "boolean",
50995099
"default": true,
51005100
"description": "Whether to include a watermark in the output file or not"
5101+
},
5102+
"preferStreaming": {
5103+
"type": "boolean",
5104+
"default": false,
5105+
"description": "Whether to prefer getting a progressive output from the provider or not"
51015106
}
51025107
}
51035108
}
@@ -10457,6 +10462,11 @@
1045710462
"type": "boolean",
1045810463
"default": true,
1045910464
"description": "Whether to include a watermark in the output file or not"
10465+
},
10466+
"preferStreaming": {
10467+
"type": "boolean",
10468+
"default": false,
10469+
"description": "Whether to prefer getting a progressive output from the provider or not"
1046010470
}
1046110471
}
1046210472
}

core/openapi.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5098,6 +5098,11 @@
50985098
"type": "boolean",
50995099
"default": true,
51005100
"description": "Whether to include a watermark in the output file or not"
5101+
},
5102+
"preferStreaming": {
5103+
"type": "boolean",
5104+
"default": false,
5105+
"description": "Whether to prefer getting a progressive output from the provider or not"
51015106
}
51025107
}
51035108
}

lib/public/TaskProcessing/SynchronousProviderOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SynchronousProviderOptions {
2222
*/
2323
public function __construct(
2424
private readonly bool $includeWatermarks = false,
25-
private readonly bool $preferStreaming = true,
25+
private readonly bool $preferStreaming = false,
2626
?callable $reportIntermediateOutput = null,
2727
) {
2828
$this->reportIntermediateOutput = $reportIntermediateOutput !== null

lib/public/TaskProcessing/Task.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ final class Task implements \JsonSerializable {
5151

5252
protected bool $includeWatermark = true;
5353

54-
protected bool $preferStreaming = true;
54+
protected bool $preferStreaming = false;
5555

5656
/**
5757
* @since 30.0.0

openapi.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8803,6 +8803,11 @@
88038803
"type": "boolean",
88048804
"default": true,
88058805
"description": "Whether to include a watermark in the output file or not"
8806+
},
8807+
"preferStreaming": {
8808+
"type": "boolean",
8809+
"default": false,
8810+
"description": "Whether to prefer getting a progressive output from the provider or not"
88068811
}
88078812
}
88088813
}
@@ -14165,6 +14170,11 @@
1416514170
"type": "boolean",
1416614171
"default": true,
1416714172
"description": "Whether to include a watermark in the output file or not"
14173+
},
14174+
"preferStreaming": {
14175+
"type": "boolean",
14176+
"default": false,
14177+
"description": "Whether to prefer getting a progressive output from the provider or not"
1416814178
}
1416914179
}
1417014180
}

0 commit comments

Comments
 (0)