* Change the Celery timeout to 15 minutes (from 10) to better accommodate automatic ingest

* Fix various small bugs in auto ingestion and tab implementation
* Update TaskManager run conditions to piggyback on API calls - guarantees a certain frequency of requests and greatly reduces chances of lock contention
This commit is contained in:
Duncan Sommerville 2015-10-29 17:53:45 -04:00
parent c92eceb60d
commit e3feb17f0c
12 changed files with 34 additions and 17 deletions

View file

@ -151,11 +151,18 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
$dbEpisode = PodcastEpisodesQuery::create()
->findOneByDbId($episode->episodeid);
// If the placeholder for the episode is somehow removed, return with a warning
if (!$dbEpisode) {
Logging::warn("Celery task $task episode $episode->episodeid unsuccessful: episode placeholder removed");
return $ref;
}
// Even if the task itself succeeds, the download could have failed, so check the status
if ($status == CELERY_SUCCESS_STATUS && $episode->status) {
if ($status == CELERY_SUCCESS_STATUS && $episode->status == 1) {
$dbEpisode->setDbFileId($episode->fileid)->save();
} else {
Logging::warn("Celery task $task episode $episode->episodeid unsuccessful with status $episode->status");
Logging::warn("Celery task $task episode $episode->episodeid unsuccessful with message $episode->error");
$dbEpisode->delete();
}