Lower poll interval for checking import status of podcast episodes

This commit is contained in:
Duncan Sommerville 2015-11-11 18:52:12 -05:00
parent c43b45a7ba
commit 8a5c25291e
3 changed files with 15 additions and 3 deletions

View File

@ -73,6 +73,7 @@ class ApiController extends Zend_Controller_Action
->addActionContext('update-replay-gain-value' , 'json') ->addActionContext('update-replay-gain-value' , 'json')
->addActionContext('update-cue-values-by-silan' , 'json') ->addActionContext('update-cue-values-by-silan' , 'json')
->addActionContext('get-usability-hint' , 'json') ->addActionContext('get-usability-hint' , 'json')
->addActionContext('poll-celery' , 'json')
->initContext(); ->initContext();
} }
@ -100,6 +101,14 @@ class ApiController extends Zend_Controller_Action
exit(); exit();
} }
public function pollCeleryAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$taskManager = TaskManager::getInstance();
$taskManager->runTask(TaskFactory::CELERY);
}
public function versionAction() public function versionAction()
{ {
$this->_helper->json->sendJson( array( $this->_helper->json->sendJson( array(

View File

@ -1272,10 +1272,10 @@ var AIRTIME = (function(AIRTIME) {
var dt = $datatables[table], var dt = $datatables[table],
wrapper = $(dt).closest(".dataTables_wrapper"); wrapper = $(dt).closest(".dataTables_wrapper");
if (oTable && typeof oTable.fnClearTable === 'function') { if (oTable && typeof oTable.fnClearTable === 'function') {
oTable.fnClearTable(); oTable.fnClearTable(false);
} }
// Don't redraw if we're switching to another hash for the library table // Don't redraw if we're switching to another hash for the library table
$.when(redraw && oTable != dt ? dt.fnDraw() : function () {}).done(function () { $.when(redraw ? dt.fnDraw() : function () {}).done(function () {
$("#library_content").find(".dataTables_wrapper").hide(); $("#library_content").find(".dataTables_wrapper").hide();
wrapper.show(); wrapper.show();
}); });

View File

@ -463,6 +463,9 @@ var AIRTIME = (function (AIRTIME) {
} }
}); });
if (pendingRows.length > 0) { if (pendingRows.length > 0) {
// Manually trigger the Celery task to update the internal
// task reference because the upload will often finish quickly
$.get('/api/poll-celery');
// Fetch the table data if there are pending rows, // Fetch the table data if there are pending rows,
// then check if any of the pending rows have // then check if any of the pending rows have
// succeeded or failed before reloading the table. // succeeded or failed before reloading the table.
@ -484,7 +487,7 @@ var AIRTIME = (function (AIRTIME) {
} }
}); });
} }
}, 10000); // Run every 10 seconds }, 5000); // Run every 5 seconds
}; };
/** /**