mirror of
https://github.com/nextcloud/server.git
synced 2026-05-26 11:22:28 -04:00
fix(TaskProcessingWorkerIsRunning): Different message if the worker has never run
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
3c775b9bd6
commit
3fa79ac7b3
2 changed files with 12 additions and 5 deletions
|
|
@ -54,11 +54,18 @@ class TaskProcessingWorkerIsRunning implements ISetupCheck {
|
|||
$lastIteration = (int)$this->appConfig->getValueString('core', 'taskprocessing_worker_last_iteration', lazy: true);
|
||||
if ($lastIteration > $this->timeFactory->now()->getTimestamp() - (60 * self::IS_RUNNING_IN_LAST_X_MINUTES)) {
|
||||
return SetupResult::success(
|
||||
$this->l10n->n('The Task Processing worker has run in the last minute.', 'The Task Processing worker has run in the last %n minute.', self::IS_RUNNING_IN_LAST_X_MINUTES)
|
||||
$this->l10n->n('The Task Processing worker has run in the last minute.', 'The Task Processing worker has run in the last %n minutes.', self::IS_RUNNING_IN_LAST_X_MINUTES)
|
||||
);
|
||||
}
|
||||
|
||||
if ($lastIteration > 0) {
|
||||
return SetupResult::warning(
|
||||
$this->l10n->t('The Task Processing worker does not seem to be running. The last run was at %s.', [date('Y-m-d H:i:s', $lastIteration)])
|
||||
);
|
||||
}
|
||||
|
||||
return SetupResult::warning(
|
||||
$this->l10n->t('The Task Processing worker does not seem to be running. The last run was at %s.', [date('Y-m-d H:i:s', (int)$this->appConfig->getValueString('core', 'taskprocessing_worker_last_iteration'))])
|
||||
$this->l10n->t('The Task Processing worker does not seem to be running. It seems it has never run so far.')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
namespace OCA\Settings\Tests;
|
||||
|
|
@ -53,7 +53,7 @@ class TaskProcessingWorkerIsRunningTest extends TestCase {
|
|||
$tasks[] = $task;
|
||||
}
|
||||
$this->taskProcessingManager->method('getTasks')->willReturn($tasks);
|
||||
|
||||
$this->timeFactory->method('now')->willReturn(new \DateTimeImmutable());
|
||||
$this->appConfig->method('getValueString')->willReturn((string)$this->timeFactory->now()->getTimestamp());
|
||||
|
||||
$this->assertEquals(SetupResult::SUCCESS, $this->check->run()->getSeverity());
|
||||
|
|
@ -70,7 +70,7 @@ class TaskProcessingWorkerIsRunningTest extends TestCase {
|
|||
$tasks[] = $task;
|
||||
}
|
||||
$this->taskProcessingManager->method('getTasks')->willReturn($tasks);
|
||||
|
||||
$this->timeFactory->method('now')->willReturn(new \DateTimeImmutable());
|
||||
$this->appConfig->method('getValueString')->willReturn((string)($this->timeFactory->now()->getTimestamp() - 60 * 10));
|
||||
|
||||
$this->assertEquals(SetupResult::WARNING, $this->check->run()->getSeverity());
|
||||
|
|
|
|||
Loading…
Reference in a new issue