Log an info message when the background job fetched something

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2020-05-29 22:52:27 +02:00 коммит произвёл Joas Schilling
Родитель 2071501469
Коммит 76add437b8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -30,6 +30,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\Notification\IManager;
@ -45,13 +46,16 @@ class CheckHostedSignalingServer extends TimedJob {
private $groupManager;
/** @var IURLGenerator */
private $urlGenerator;
/** @var ILogger */
private $logger;
public function __construct(ITimeFactory $timeFactory,
HostedSignalingServerService $hostedSignalingServerService,
IConfig $config,
IManager $notificationManager,
IGroupManager $groupManager,
IURLGenerator $urlGenerator) {
IURLGenerator $urlGenerator,
ILogger $logger) {
parent::__construct($timeFactory);
$this->setInterval(3600);
$this->hostedSignalingServerService = $hostedSignalingServerService;
@ -59,6 +63,7 @@ class CheckHostedSignalingServer extends TimedJob {
$this->notificationManager = $notificationManager;
$this->groupManager = $groupManager;
$this->urlGenerator = $urlGenerator;
$this->logger = $logger;
}
protected function run($argument): void {
@ -146,6 +151,8 @@ class CheckHostedSignalingServer extends TimedJob {
$this->config->setAppValue('spreed', 'hosted-signaling-server-account-last-checked', $this->time->getTime());
if (!is_null($notificationSubject)) {
$this->logger->info('Hosted signaling server background job caused a notification: ' . $notificationSubject . ' ' . json_encode($notificationParameters), ['app' => 'spreed']);
$notification = $this->notificationManager->createNotification();
$notification
->setApp('spreed')