Fix download counter reset timer

This commit is contained in:
Duncan Sommerville 2015-10-29 09:23:41 -04:00
parent 1067e9f8ae
commit cd17a23d13
1 changed files with 3 additions and 2 deletions

View File

@ -86,7 +86,7 @@ final class TaskManager {
$this->_con->beginTransaction();
try {
$lock = $this->_getLock();
if ($lock && (microtime(true) < $lock['valstr'] + self::TASK_INTERVAL_SECONDS)) {
if ($lock && (microtime(true) < ($lock['valstr'] + self::TASK_INTERVAL_SECONDS))) {
// Propel caches the database connection and uses it persistently, so if we don't
// use commit() here, we end up blocking other queries made within this request
$this->_con->commit();
@ -256,7 +256,7 @@ class StationPodcastTask implements AirtimeTask {
*/
public function shouldBeRun() {
$lastReset = Application_Model_Preference::getStationPodcastDownloadResetTimer();
return empty($lastReset) || (microtime(true) > $lastReset + self::STATION_PODCAST_RESET_TIMER_SECONDS);
return empty($lastReset) || (microtime(true) > ($lastReset + self::STATION_PODCAST_RESET_TIMER_SECONDS));
}
/**
@ -264,6 +264,7 @@ class StationPodcastTask implements AirtimeTask {
*/
public function run() {
Application_Model_Preference::resetStationPodcastDownloadCounter();
Application_Model_Preference::setStationPodcastDownloadResetTimer(microtime(true));
}
}