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 66083b9 commit 6817e70
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 3 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 OCP\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.');
}
}
2 changes: 1 addition & 1 deletion lib/BackgroundJob/ExpireSignalingMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace OCA\Talk\BackgroundJob;

use OC\BackgroundJob\TimedJob;
use OCP\BackgroundJob\TimedJob;
use OCA\Talk\Signaling\Messages;

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/BackgroundJob/RemoveEmptyRooms.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace OCA\Talk\BackgroundJob;

use OC\BackgroundJob\TimedJob;
use OCP\BackgroundJob\TimedJob;
use OCA\Talk\Manager;
use OCA\Talk\Room;
use Psr\Log\LoggerInterface;
Expand Down
2 changes: 1 addition & 1 deletion lib/BackgroundJob/ResetAssignedSignalingServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace OCA\Talk\BackgroundJob;

use OC\BackgroundJob\TimedJob;
use OCP\BackgroundJob\TimedJob;
use OCA\Talk\Manager;
use OCP\ICache;
use OCP\ICacheFactory;
Expand Down

0 comments on commit 6817e70

Please sign in to comment.