mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-06 14:17:27 +02:00
scheduler - only register built-in purge_orphaned_scheduled_tasks if running as default name
This commit is contained in:
parent
5263a07f61
commit
4cc40ddaa4
@ -3,20 +3,23 @@ class Scheduler {
|
||||
private static ?Scheduler $instance = null;
|
||||
|
||||
const TASK_RC_EXCEPTION = -100;
|
||||
const DEFAULT_NAME = 'Default Scheduler';
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
private array $scheduled_tasks = [];
|
||||
|
||||
private string $name;
|
||||
|
||||
function __construct(string $name = 'Default Scheduler') {
|
||||
function __construct(string $name = self::DEFAULT_NAME) {
|
||||
$this->set_name($name);
|
||||
|
||||
$this->add_scheduled_task('purge_orphaned_scheduled_tasks', '@weekly',
|
||||
function() {
|
||||
return $this->purge_orphaned_tasks();
|
||||
}
|
||||
);
|
||||
if ($name === self::DEFAULT_NAME) {
|
||||
$this->add_scheduled_task('purge_orphaned_scheduled_tasks', '@weekly',
|
||||
function() {
|
||||
return $this->purge_orphaned_tasks();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getInstance(): Scheduler {
|
||||
|
Loading…
Reference in New Issue
Block a user