/**
  * @return string
  */
 public function sendAction()
 {
     $queueSize = $this->options->getQueueSize();
     $throttleSize = $this->mailThrottle->getThrottleSize();
     if ($queueSize < 1 || 0 === $throttleSize) {
         $this->logger->err('Can not send anything.');
         return '';
     }
     $currentQueueSize = $throttleSize > 0 ? min($queueSize, $throttleSize) : $queueSize;
     $readyQueue = $this->queueItemRepository->getReadyQueue($currentQueueSize);
     $this->processQueueToSend($readyQueue);
     if ($this->hasCacheStorage()) {
         $this->cacheStorage->setItem(\DmMailer\View\DataProvider\Kpi::CS_LAST_MESSAGE_SENDING, $this->getTime());
     }
     return '';
 }
Example #2
0
 /**
  * @return array
  */
 private function getAckedQueueSize()
 {
     $count = $this->queueItemRepo->getAckedQueueSize();
     $kpiType = self::INFO;
     if ($count > $this->options->getQueueSize()) {
         $kpiType = self::DANGER;
     }
     return [self::ACKED_QUEUE_SIZE => [self::VALUE => $count, self::TYPE => $kpiType]];
 }
 /**
  * @return array
  */
 private function getFormViewData()
 {
     return ['form' => $this->manager->getForm(), 'filePathBase' => $this->options->getFilePathBase(), 'fileUrlBase' => $this->options->getFileUrlBase(), 'serverUrl' => $this->url()->fromRoute('home', [], ['force_canonical' => true]), 'tinyMceLang' => $this->tinyMceLang];
 }