SAAS-1244 - improve pending podcast episode sweeping; small bugfixes
This commit is contained in:
parent
21846be7ed
commit
17a03e088f
5 changed files with 14 additions and 8 deletions
|
@ -134,7 +134,7 @@ class Application_Service_MediaService
|
|||
->filterByDbUtime($oneHourAgo, Criteria::LESS_EQUAL)
|
||||
->find();
|
||||
$pendingEpisodes = Application_Service_PodcastEpisodeService::getStuckPendingImports();
|
||||
return !empty(self::$_pendingFiles) && !empty($pendingEpisodes);
|
||||
return !self::$_pendingFiles->isEmpty() || !empty($pendingEpisodes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
|
|||
|
||||
const DOWNLOAD = 'download';
|
||||
|
||||
const PENDING_EPISODE_TIMEOUT_SECONDS = 3600;
|
||||
const PENDING_EPISODE_TIMEOUT_SECONDS = 900;
|
||||
|
||||
/**
|
||||
* @var string service name to store in ThirdPartyTrackReferences database
|
||||
|
@ -239,12 +239,15 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
|
|||
}
|
||||
|
||||
/**
|
||||
* Find any episode placeholders that have been stuck pending (empty file ID) for over an hour
|
||||
* Find any episode placeholders that have been stuck pending (empty file ID) for over
|
||||
* PENDING_EPISODE_TIMEOUT_SECONDS
|
||||
*
|
||||
* @see Application_Service_PodcastEpisodeService::PENDING_EPISODE_TIMEOUT_SECONDS
|
||||
*
|
||||
* @return array the episode imports stuck in pending
|
||||
*/
|
||||
public static function getStuckPendingImports() {
|
||||
$oneHourAgo = gmdate(DEFAULT_TIMESTAMP_FORMAT, (microtime(true) - self::PENDING_EPISODE_TIMEOUT_SECONDS));
|
||||
$timeout = gmdate(DEFAULT_TIMESTAMP_FORMAT, (microtime(true) - self::PENDING_EPISODE_TIMEOUT_SECONDS));
|
||||
$episodes = PodcastEpisodesQuery::create()
|
||||
->filterByDbFileId()
|
||||
->find();
|
||||
|
@ -254,7 +257,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
|
|||
->findOneByDbForeignId(strval($episode->getDbId()));
|
||||
if (!empty($ref)) {
|
||||
$task = CeleryTasksQuery::create()
|
||||
->filterByDbDispatchTime($oneHourAgo, Criteria::LESS_EQUAL)
|
||||
->filterByDbDispatchTime($timeout, Criteria::LESS_EQUAL)
|
||||
->findOneByDbTrackReference($ref->getDbId());
|
||||
if (!empty($task)) {
|
||||
array_push($stuckImports, $episode);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue