More small TaskManager and auto-ingest fixes

This commit is contained in:
Duncan Sommerville 2015-10-29 18:26:20 -04:00
parent e3feb17f0c
commit d08e19a93a
2 changed files with 20 additions and 16 deletions

View file

@ -30,7 +30,12 @@ class PodcastManager {
$service = new Application_Service_PodcastEpisodeService();
foreach ($autoIngestPodcasts as $podcast) {
$episodes = static::_findUningestedEpisodes($podcast, $service);
$podcast->setDbAutoIngestTimestamp(gmdate('r'))->save();
// Since episodes don't have to be uploaded with a time (H:i:s) component,
// store the timestamp of the most recent (first pushed to the array) episode
// that we're ingesting.
// Note that this folds to the failure case (Celery task timeout/download failure)
// but will at least continue to ingest new episodes.
$podcast->setDbAutoIngestTimestamp(gmdate('r', strtotime($episodes[0]->getDbPublicationDate())))->save();
$service->downloadEpisodes($episodes);
}