aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2024-07-08 18:04:46 +0200
committerJulien Veyssier <julien-nc@posteo.net>2024-07-23 17:12:38 +0200
commitdf086a8c207ec6765a94955f6638fa7aacf4c06a (patch)
tree25679134ebb648dc8edcadfe878587b3868d6746 /lib/public
parent6865be05ec6359240d8dde56d141bbc55a00dfc1 (diff)
downloadnextcloud-server-df086a8c207ec6765a94955f6638fa7aacf4c06a.tar.gz
nextcloud-server-df086a8c207ec6765a94955f6638fa7aacf4c06a.zip
feat(taskprocessing): add start, stop and schedule time to tasks
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/TaskProcessing/Task.php57
1 files changed, 56 insertions, 1 deletions
diff --git a/lib/public/TaskProcessing/Task.php b/lib/public/TaskProcessing/Task.php
index 44834c3b846..db8e4d7fab5 100644
--- a/lib/public/TaskProcessing/Task.php
+++ b/lib/public/TaskProcessing/Task.php
@@ -63,6 +63,10 @@ final class Task implements \JsonSerializable {
*/
protected int $status = self::STATUS_UNKNOWN;
+ protected ?int $scheduledAt = null;
+ protected ?int $startedAt = null;
+ protected ?int $endedAt = null;
+
/**
* @param string $taskTypeId
* @param array<string,list<numeric|string>|numeric|string> $input
@@ -201,7 +205,55 @@ final class Task implements \JsonSerializable {
}
/**
- * @psalm-return array{id: ?int, lastUpdated: int, type: string, status: 'STATUS_CANCELLED'|'STATUS_FAILED'|'STATUS_SUCCESSFUL'|'STATUS_RUNNING'|'STATUS_SCHEDULED'|'STATUS_UNKNOWN', userId: ?string, appId: string, input: array<array-key, list<numeric|string>|numeric|string>, output: ?array<array-key, list<numeric|string>|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float}
+ * @return int|null
+ * @since 30.0.0
+ */
+ final public function getScheduledAt(): ?int {
+ return $this->scheduledAt;
+ }
+
+ /**
+ * @param int|null $scheduledAt
+ * @since 30.0.0
+ */
+ final public function setScheduledAt(?int $scheduledAt): void {
+ $this->scheduledAt = $scheduledAt;
+ }
+
+ /**
+ * @return int|null
+ * @since 30.0.0
+ */
+ final public function getStartedAt(): ?int {
+ return $this->startedAt;
+ }
+
+ /**
+ * @param int|null $startedAt
+ * @since 30.0.0
+ */
+ final public function setStartedAt(?int $startedAt): void {
+ $this->startedAt = $startedAt;
+ }
+
+ /**
+ * @return int|null
+ * @since 30.0.0
+ */
+ final public function getEndedAt(): ?int {
+ return $this->endedAt;
+ }
+
+ /**
+ * @param int|null $endedAt
+ * @since 30.0.0
+ */
+ final public function setEndedAt(?int $endedAt): void {
+ $this->endedAt = $endedAt;
+ }
+
+ /**
+ * @psalm-return array{id: ?int, lastUpdated: int, type: string, status: 'STATUS_CANCELLED'|'STATUS_FAILED'|'STATUS_SUCCESSFUL'|'STATUS_RUNNING'|'STATUS_SCHEDULED'|'STATUS_UNKNOWN', userId: ?string, appId: string, input: array<array-key, list<numeric|string>|numeric|string>, output: ?array<array-key, list<numeric|string>|numeric|string>, customId: ?string, completionExpectedAt: ?int, progress: ?float, scheduledAt: ?int, startedAt: ?int, endedAt: ?int}
* @since 30.0.0
*/
final public function jsonSerialize(): array {
@@ -217,6 +269,9 @@ final class Task implements \JsonSerializable {
'customId' => $this->getCustomId(),
'completionExpectedAt' => $this->getCompletionExpectedAt()?->getTimestamp(),
'progress' => $this->getProgress(),
+ 'scheduledAt' => $this->getScheduledAt(),
+ 'startedAt' => $this->getStartedAt(),
+ 'endedAt' => $this->getEndedAt(),
];
}