forked from kaltura/server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New job type KAsyncValidateLiveMediaServers
- Loading branch information
tan-tan-kanarek
committed
Nov 28, 2013
1 parent
4d3f200
commit 62f49eb
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
batch/batches/ValidateLiveMediaServers/KAsyncValidateLiveMediaServers.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* @package Scheduler | ||
* @subpackage ValidateLiveMediaServers | ||
*/ | ||
|
||
/** | ||
* Validates periodically that all live entries are still broadcasting to the connected media servers | ||
* | ||
* @package Scheduler | ||
* @subpackage ValidateLiveMediaServers | ||
*/ | ||
class KAsyncValidateLiveMediaServers extends KPeriodicWorker | ||
{ | ||
/* (non-PHPdoc) | ||
* @see KBatchBase::getType() | ||
*/ | ||
public static function getType() | ||
{ | ||
return KalturaBatchJobType::CLEANUP; | ||
} | ||
|
||
/* (non-PHPdoc) | ||
* @see KBatchBase::run() | ||
*/ | ||
public function run($jobs = null) | ||
{ | ||
KalturaLog::info("Validating live media servers"); | ||
|
||
$filter = new KalturaLiveEntryFilter(); | ||
$filter->orderBy = KalturaLiveEntryOrderBy::CREATED_AT_ASC; | ||
|
||
$entries = self::$kClient->liveStream->listAction($filter); | ||
while(count($entries->objects)) | ||
{ | ||
foreach($entries->objects as $entry) | ||
{ | ||
/* @var $entry KalturaLiveEntry */ | ||
self::impersonate($entry->partnerId); | ||
self::$kClient->liveStream->validateRegisteredMediaServers($entry->id); | ||
self::unimpersonate(); | ||
|
||
$filter->createdAtGreaterThanOrEqual = $entry->createdAt; | ||
} | ||
|
||
$entries = self::$kClient->liveStream->listAction($filter); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
batch/batches/ValidateLiveMediaServers/KAsyncValidateLiveMediaServersDebug.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
/** | ||
* @package Scheduler | ||
* @subpackage Debug | ||
*/ | ||
|
||
chdir(dirname(__FILE__) . "/../../"); | ||
|
||
require_once (__DIR__ . "/../../bootstrap.php"); | ||
|
||
$iniDir = dirname(__FILE__) . "/../configurations/batch"; // should be the full file path | ||
|
||
|
||
$kdebuger = new KGenericDebuger($iniDir); | ||
$kdebuger->run('KAsyncValidateLiveMediaServers'); |
12 changes: 12 additions & 0 deletions
12
batch/batches/ValidateLiveMediaServers/KAsyncValidateLiveMediaServersExe.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
/** | ||
* Will run the KAsyncValidateLiveMediaServers | ||
* | ||
* @package Scheduler | ||
* @subpackage ValidateLiveMediaServers | ||
*/ | ||
require_once (__DIR__ . "/../../bootstrap.php"); | ||
|
||
$instance = new KAsyncValidateLiveMediaServers(); | ||
$instance->run(); | ||
$instance->done(); |