public function perform()
 {
     if ($this->canPerform()) {
         SyncManager::syncRelated($this->getCampaign());
         RedisLimit::instance()->del($this->getCampaign());
         $this->addTeasers();
         $this->updateScore();
         $this->addCache();
     }
 }
Beispiel #2
0
 /**
  * Инициирует вызов синхронизации уровня на котором исчерпаны лимиты.
  *
  * @return bool
  */
 public function handleLimit()
 {
     if (RedisLimit::instance()->isExists($this)) {
         // ничего не делаем, и детям не даем если лимит уже висит.
         return true;
     }
     if ($this->campaign->handleLimit()) {
         return true;
     } elseif ($this->isLimitExceeded()) {
         RedisLimit::instance()->set($this);
         SyncManager::syncNowAndTomorrow($this);
         return true;
     }
     return false;
 }