Fix download counter reset timer
This commit is contained in:
parent
1067e9f8ae
commit
cd17a23d13
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue