public function execute()
 {
     $summary = [];
     foreach ($this->config->getPartnerPorts() as $port) {
         $data = $this->performRequest($this->config->getHost(), $port);
         foreach ($data as $row) {
             $id = $row['id'];
             $count = $row['count'];
             if (!isset($summary[$id])) {
                 $summary[$id] = $count;
             } elseif ($summary[$id] < $count) {
                 $summary[$id] = $count;
             }
         }
     }
     foreach ($summary as $id => $count) {
         $entity = new Cmd();
         $entity->setCount($count);
         $this->collection->set($id, $entity);
     }
 }
Exemplo n.º 2
0
 /**
  * Run application.
  */
 public function run()
 {
     $this->logger->debug('Application is started on ' . $this->config->getHost() . ':' . $this->config->getPort());
     $this->logger->debug('Partner application ports: ' . implode(',', $this->config->getPartnerPorts()));
     $this->getLoop()->run();
 }