diff options
author | Marcel Klehr <mklehr@gmx.net> | 2023-11-02 12:07:10 +0100 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2023-11-02 12:07:10 +0100 |
commit | ee76cc512ccb9dcc968345e821f50f65454fbaae (patch) | |
tree | 205d1ed24356027b886c06f8bd14fc3e10e49116 /lib/private/TextToImage | |
parent | 9a494407ee6cd8e6af4f96777ef00f339b1d7fa4 (diff) | |
download | nextcloud-server-ee76cc512ccb9dcc968345e821f50f65454fbaae.tar.gz nextcloud-server-ee76cc512ccb9dcc968345e821f50f65454fbaae.zip |
fix(TextToImage): Always set completionExpectedAt in run/schedule methods
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib/private/TextToImage')
-rw-r--r-- | lib/private/TextToImage/Manager.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/TextToImage/Manager.php b/lib/private/TextToImage/Manager.php index a1f0f97b0c5..f68f657277f 100644 --- a/lib/private/TextToImage/Manager.php +++ b/lib/private/TextToImage/Manager.php @@ -119,6 +119,9 @@ class Manager implements IManager { $this->logger->debug('Trying to run Text2Image provider '.$provider::class); try { $task->setStatus(Task::STATUS_RUNNING); + $completionExpectedAt = new \DateTime('now'); + $completionExpectedAt->add(new \DateInterval('PT'.$provider->getExpectedRuntime().'S')); + $task->setCompletionExpectedAt($completionExpectedAt); if ($task->getId() === null) { $this->logger->debug('Inserting Text2Image task into DB'); $taskEntity = $this->taskMapper->insert(DbTask::fromPublicTask($task)); @@ -204,6 +207,9 @@ class Manager implements IManager { } $this->logger->debug('Scheduling Text2Image Task'); $task->setStatus(Task::STATUS_SCHEDULED); + $completionExpectedAt = new \DateTime('now'); + $completionExpectedAt->add(new \DateInterval('PT'.$this->getPreferredProviders()[0]->getExpectedRuntime().'S')); + $task->setCompletionExpectedAt($completionExpectedAt); $taskEntity = DbTask::fromPublicTask($task); $this->taskMapper->insert($taskEntity); $task->setId($taskEntity->getId()); |