Skip to content

Commit ebcfbbc

Browse files
committed
Make background job time insensitive
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent d5b7e1f commit ebcfbbc

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

lib/BackgroundJob/ExpireActivities.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* @copyright Copyright (c) 2016, ownCloud, Inc.
46
*
@@ -22,34 +24,31 @@
2224

2325
namespace OCA\Activity\BackgroundJob;
2426

25-
use OC\BackgroundJob\TimedJob;
2627
use OCA\Activity\Data;
28+
use OCP\AppFramework\Utility\ITimeFactory;
29+
use OCP\BackgroundJob\TimedJob;
2730
use OCP\IConfig;
2831

29-
/**
30-
* Class ExpireActivities
31-
*
32-
* @package OCA\Activity\BackgroundJob
33-
*/
3432
class ExpireActivities extends TimedJob {
3533
/** @var Data */
3634
protected $data;
3735
/** @var IConfig */
3836
protected $config;
3937

40-
/**
41-
* @param Data $data
42-
* @param IConfig $config
43-
*/
44-
public function __construct(Data $data, IConfig $config) {
38+
public function __construct(ITimeFactory $time,
39+
Data $data,
40+
IConfig $config) {
41+
parent::__construct($time);
42+
4543
// Run once per day
4644
$this->setInterval(60 * 60 * 24);
45+
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
4746

4847
$this->data = $data;
4948
$this->config = $config;
5049
}
5150

52-
protected function run($argument) {
51+
protected function run($argument): void {
5352
// Remove activities that are older then one year
5453
$expireDays = $this->config->getSystemValue('activity_expire_days', 365);
5554
$this->data->expire($expireDays);

0 commit comments

Comments
 (0)