Skip to content

Commit

Permalink
check if Matterbridge processes are running correctly and kill the zo…
Browse files Browse the repository at this point in the history
…mbie ones every 15 min

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
  • Loading branch information
Julien Veyssier committed Sep 7, 2020
1 parent bf37e6c commit 5c02b82
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ And in the works for the [coming versions](https://github.com/nextcloud/spreed/m
<job>OCA\Talk\BackgroundJob\ResetAssignedSignalingServer</job>
<job>OCA\Talk\BackgroundJob\CheckReferenceIdColumn</job>
<job>OCA\Talk\BackgroundJob\CheckHostedSignalingServer</job>
<job>OCA\Talk\BackgroundJob\CheckMatterbridges</job>
</background-jobs>

<repair-steps>
Expand Down
57 changes: 57 additions & 0 deletions lib/BackgroundJob/CheckMatterbridges.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Julien Veyssier <eneiluj@posteo.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\Talk\BackgroundJob;

use OC\BackgroundJob\TimedJob;
use OCA\Talk\MatterbridgeManager;
use Psr\Log\LoggerInterface;

/**
* Class CheckMatterbridges
*
* @package OCA\Talk\BackgroundJob
*/
class CheckMatterbridges extends TimedJob {

/** @var MatterbridgeManager */
protected $bridgeManager;

/** @var LoggerInterface */
protected $logger;

public function __construct(MatterbridgeManager $bridgeManager,
LoggerInterface $logger) {
// Every 15 minutes
$this->setInterval(60 * 15);

$this->bridgeManager = $bridgeManager;
$this->logger = $logger;
}

protected function run($argument): void {
$this->bridgeManager->checkAllBridges();
$this->bridgeManager->killZombieBridges();
$this->logger->info('Checked if Matterbridge instances are running correctly.');
}
}

0 comments on commit 5c02b82

Please sign in to comment.