2024-04-30 10:30:24 -04:00
|
|
|
<?php
|
|
|
|
|
|
2024-05-23 03:26:56 -04:00
|
|
|
/**
|
|
|
|
|
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
*/
|
2024-04-30 10:30:24 -04:00
|
|
|
namespace OC\TaskProcessing;
|
|
|
|
|
|
|
|
|
|
use OCP\AppFramework\Utility\ITimeFactory;
|
|
|
|
|
use OCP\BackgroundJob\TimedJob;
|
|
|
|
|
|
|
|
|
|
class RemoveOldTasksBackgroundJob extends TimedJob {
|
|
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
|
ITimeFactory $timeFactory,
|
2025-08-06 09:34:15 -04:00
|
|
|
private Manager $taskProcessingManager,
|
2024-04-30 10:30:24 -04:00
|
|
|
) {
|
|
|
|
|
parent::__construct($timeFactory);
|
|
|
|
|
$this->setInterval(60 * 60 * 24);
|
|
|
|
|
// can be deferred to maintenance window
|
2024-10-07 11:36:55 -04:00
|
|
|
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
|
2024-04-30 10:30:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @inheritDoc
|
|
|
|
|
*/
|
2024-05-06 03:44:48 -04:00
|
|
|
protected function run($argument): void {
|
2025-08-06 09:34:15 -04:00
|
|
|
iterator_to_array($this->taskProcessingManager->cleanupOldTasks());
|
2025-08-06 06:21:23 -04:00
|
|
|
}
|
2024-04-30 10:30:24 -04:00
|
|
|
}
|